Created
February 17, 2017 15:13
-
-
Save kroovysteph/fe282d51221d0a212aa78f2ae9c10a29 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/bash | |
## DEPENDENCIES | |
# | |
# * sudo apt-get install cryptsetup lvm2 | |
# | |
## PREPARATION | |
# | |
# * use "sudo vgscan" in order to find out volume group (eg. "x220-vg") | |
# * use "sudo blkid" in order to find out UUID | |
# * /etc/fstab entry: | |
# * "UUID=65878bd-e21s-2c6a-3242-6aff67dba443 /mnt/my_mount_point auto rw,user,noauto 0 0" | |
# | |
if [ ! $# -eq 0 -a $1 = "mount" ]; then | |
# mount | |
sudo cryptsetup luksOpen /dev/sda5 old_encrypted && | |
echo ":: sudo cryptsetup luksOpen /dev/sda5 old_encrypted"; | |
sudo vgchange -a y x220-vg && | |
echo ":: sudo vgchange -a y x220-vg"; | |
mount /home/kroovy/old_data && | |
echo ":: mount /home/kroovy/old_data"; | |
elif [ ! $# -eq 0 -a $1 = "umount" ]; then | |
# umount | |
umount /home/kroovy/old_data && | |
echo ":: umount /home/kroovy/old_data"; | |
sudo vgchange -a n x220-vg && | |
echo ":: sudo vgchange -a n x220-vg"; | |
sudo cryptsetup luksClose old_encrypted && | |
echo ":: sudo cryptsetup luksClose old_encrypted"; | |
else | |
# print help | |
echo "Synthax:"; | |
echo " oldstuff mount"; | |
echo " oldstuff umount"; | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment