-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add helpder script to set up and mount a tmpdir volume for a job. Use ext4, because is causes less load on the system than xfs. Tune filesystem for speed, not for durability.
- Loading branch information
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#! /usr/bin/bash | ||
|
||
# Input (environment): | ||
# | ||
# MXQ_JOBID : job ident | ||
# MXQ_SIZE : size in GB | ||
# MXQ_UID : uid | ||
|
||
# Output: | ||
# | ||
# /dev/shm/mxqd/tmp/$JOBID mounted, space from /scratch/local2 | ||
|
||
tmpdir=/scratch/local2/mxqd/tmp | ||
mntdir=/dev/shm/mxqd/mnt/job | ||
filename=$tmpdir/$MXQ_JOBID.tmp | ||
mountpoint=$mntdir/$MXQ_JOBID | ||
|
||
umask 006 | ||
mkdir -p $tmpdir | ||
mkdir -p $mntdir | ||
|
||
status=1; | ||
|
||
if fallocate -l ${MXQ_SIZE}G $filename; then | ||
if loopdevice=$(losetup --find --show $filename); then | ||
if mkfs.ext4 \ | ||
-m 0 \ | ||
-E nodiscard,mmp_update_interval=300,lazy_journal_init=1,root_owner=$MXQ_UID:0 \ | ||
-O '64bit,ext_attr,filetype,^has_journal,huge_file,inline_data,^mmp,^quota,sparse_super2' \ | ||
$loopdevice \ | ||
&& mkdir -p $mountpoint && mount -Odata=writeback,barrier=0 $loopdevice $mountpoint; then | ||
status=0 | ||
fi | ||
losetup -d $loopdevice | ||
fi | ||
rm $filename | ||
else | ||
test -e $fileame && rm $filename | ||
fi | ||
exit $status |