Category Archives: Ubuntu

Backing up ecryptfs on an LV

Because I know I will forget this in the future:

# create the LV snapshot
hodor ~ # lvcreate -L5G -s -n backup-home /dev/hodor/home
  Logical volume "backup-home" created

# create the mount point and mount the snapshot
hodor ~ # mkdir /mnt/blah
hodor ~ # mount /dev/hodor/backup-home /mnt/blah

# mount ecryptfs and go to where it tells you to go
hodor ~ # ecryptfs-recover-private /mnt/blah/.ecryptfs/david/.Private/
INFO: Found [/mnt/blah/.ecryptfs/david/.Private/].
Try to recover this directory? [Y/n]: y
INFO: Found your wrapped-passphrase
Do you know your LOGIN passphrase? [Y/n] y
INFO: Enter your LOGIN passphrase...
Passphrase: 
Inserted auth tok with sig [<OMITTED>] into the user session keyring
INFO: Success!  Private data mounted at [/tmp/ecryptfs.UahEKdmV].
hodor ~ # cd /tmp/ecryptfs.UahEKdmV/

# backup the damn thing
hodor ecryptfs.UahEKdmV # tar --one-file-system --exclude=.Private --exclude=.cache -pScvzf /home/david/homebackup.tar.gz .

# now clean up this mess
hodor ecryptfs.UahEKdmV # cd
hodor ~ # umount /tmp/ecryptfs.UahEKdmV
hodor ~ # umount /mnt/blah
hodor ~ # rmdir /mnt/blah
hodor ~ # lvremove /dev/hodor/backup-home 
Do you really want to remove and DISCARD active logical volume backup-home? [y/n]: y
  Logical volume "backup-home" successfully removed

Then throw the backup somewhere. Done.

UFW – We can rebuild him. We have the technology.

So say you have UFW (uncomplicated firewall) installed on your server and you accidentally issue “iptables -F” and kill all of your networking. “No worries,” you think, “I can just restart UFW.” Except you find that after you issue “ufw disable; ufw enable” that it still does not work. Welp, crap. You’re hosed now. Have no fear, fellow sysadmin! Rescue is on the way. Read more »