File: mount-ext4-ramdisk.sh

package info (click to toggle)
gocryptfs 2.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,132 kB
  • sloc: sh: 1,091; ansic: 208; makefile: 88
file content (20 lines) | stat: -rwxr-xr-x 389 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash -ex

MNT=/mnt/ext4-ramdisk

if mountpoint "$MNT" ; then
	exit 1
fi

IMG=$(mktemp /tmp/ext4-ramdisk-XXX.img)

# unlink the file when done, space will be
# reclaimed once the fs is unmounted. Also
# cleans up in the error case.
trap 'rm "$IMG"' EXIT

dd if=/dev/zero of="$IMG" bs=1M count=1030 status=none
mkfs.ext4 -q "$IMG"
mkdir -p "$MNT"
mount "$IMG" "$MNT"
chmod 777 "$MNT"