clean
1. umounts all the volumes using a /dev/dm-* device
- 2. LUKS-close all the volumes appearing in /dev/mapper
+ 2. luks-close all the volumes appearing in /dev/mapper
3. Delete all the loop devices
sync
- Mounts both files as LUKS volumes, runs a dry-run rsync, and asks for
- interactive confirmation before synchronizing.
+ Mounts both files as luks volumes, runs a dry-run rsync, and asks for
+ interactive confirmation, then rsync.
fsck
- LUKS-open the provided file and run fsck on it.
+ luks-open the provided file and run fsck on it.
mount|umount
Automagically figures out from /etc/fstab what is the /dev/mapper/
- device associated to the dir, and both LUKS-opens/mounts or
- umounts/LUKS-closes it.
+ device associated to the dir, and both luks-opens/mounts or
+ umounts/luks-closes it.
EOF
}
clean)
- # mount | grep ^'/dev/dm-[0-9]*' | sed -e 's/^.* on \([^ ]*\) .*$/\1/' | \
-
- mount | grep ^'/dev/mapper' | sed -e 's/^.* on \([^ ]*\) .*$/\1/' | \
- while read line
- do
- echo "umount ${line}"
- umount ${line}
- done
-
- ls /dev/mapper | grep -v ^control$ | \
- while read line
- do
- echo "cryptsetup luksClose ${line[0]}"
- cryptsetup luksClose "${line[0]}"
- done
-
- losetup -a | sed -e "s/:.*$//" | \
- while read line
- do
- echo "losetup -d ${line}"
- losetup -d ${line}
- done
+ mount | grep ^'/dev/mapper' | sed -e 's/^.* on \([^ ]*\) .*$/\1/' | while read line
+ do
+ echo "umount ${line}"
+ umount "${line}"
+ done
+
+ find /dev/mapper -type l | while read line
+ do
+ echo "cryptsetup luksClose ${line}"
+ cryptsetup luksClose "${line}"
+ done
+
+ losetup -a | sed -e "s/:.*$//" | while read line
+ do
+ echo "losetup -d ${line}"
+ losetup -d "${line}"
+ done
exit 0
else
- echo "\`${device}' does not look like a LUKS one"
+ echo "\`${device}' does not look like a luks one"
fi