I have a huge number of photos, and I want to move just my /Pictures folder to a second SATA drive in my computer for performance reasons. I want everything to work as it is now, except that /Pictures will be by itself on the second drive.
/Home (sda) and the second drive(sdb) are encrypted. For the primary drive, I chose the encrypted home option at install. Later, I added the second drive. I formatted it and chose encryption using the Disk Utility. I can reinstall if this all has to be done at once.
What I tried so far was adding a symlink to the new drive from inside /Pictures, and using PySDM (to modify Fstab) to auto-mount the second drive at boot. Since the second drive is encrypted, this didn't work. It can't be mounted until I login and unlock the keychain with my password.
Also, the symlink added an extra step in the file paths, which broke some custom links.
ln -s /media/Pix /home/tom/Pictures and all variations of this with and without trailing slashes give me either a link inside /Pictures, or no link at all. (possibly missing something simple here?) Drive 2 (sdb) is /Pix, and all my pictures are in folders at its root directory. I want to click on Pictures from my home folder in Nautilus, and be taken directly to the root directory of the second drive. This just isn't happening. I either get a new link inside /Pictures, or I'm taken to the empty /Pictures folder (on sda)
What's the best way to do this? It's important to keep everything encrypted, and have /Pictures work just like if it was in /home. I also need my automatic backups to be collecting the photos in their new location.
****Edits** I tried following RAOF's answer but I'm stuck now. Here's how far I got:
cryptsetup was already installed, I edited it and copied the suggestion exactly, it now looks like this:
# <target name> <source device> <key file> <options> cryptswap1 /dev/sda2 /dev/urandom swap,cipher=aes-cbc-essiv:sha256 sdb_crypt UUID=<redacted>-4ef3-a4ff-7c9db92025d7 none luks
I have an encrypted /home obviously, that's the other entry.
ls -lah /dev/disks/by-uuid
simply didn't work, I get "ls: cannot access /dev/disks/by-uuid: No such file or directory"
ls -l /dev/disk/by-uuid/
does work, it's the method here on the Ubuntu help page That gives me the following:
ls -l /dev/disk/by-uuid/ total 0 lrwxrwxrwx 1 root root 10 2012-02-06 08:15 <redacted>-40ba-be89-9591daf722c9 -> ../../sdd1 lrwxrwxrwx 1 root root 10 2012-02-06 08:15 <redacted>-4ef3-a4ff-7c9db92025d7 -> ../../sdb1 lrwxrwxrwx 1 root root 10 2012-02-06 08:15 <redacted>-49da-bcca-879e44afe63c -> ../../sda1 lrwxrwxrwx 1 root root 10 2012-02-06 08:15 <redacted>-4cee-9ef7-c745ee596438 -> ../../dm-1 lrwxrwxrwx 1 root root 10 2012-02-06 08:15 <redacted>-48ed-9725-5179cd588c28 -> ../../dm-0 lrwxrwxrwx 1 root root 10 2012-02-06 08:15 <redacted>-4bb6-bf6e-197af4d6afdc -> ../../sdc1
The problem now is with fstab. I have tried several variations, and none work so far. Here's what I started with:
UUID=<redacted>-4bb6-bf6e-197af4d6afdc /home ext4 defaults 0 2 UUID=<redacted>-4ef3-a4ff-7c9db92025d7 /media/sdb1 crypto_LUKS noauto 0 0 UUID=<redacted>-49da-bcca-879e44afe63c / ext4 defaults 0 1 UUID=<redacted>-4cee-9ef7-c745ee596438 /media/Pix ext4 noauto 0 0
which tries to mount the encrypted partition at boot, which is too early since I haven't entered my password yet. I removed the last line and changed the second entry to auto, like below.
UUID=<redacted>-4bb6-bf6e-197af4d6afdc /home ext4 defaults 0 2 UUID=<redacted>-4ef3-a4ff-7c9db92025d7 /media/sdb1 crypto_LUKS auto 0 0 UUID=<redacted>-49da-bcca-879e44afe63c / ext4 defaults 0 1
This asked me for my passphrase for /sdb_crypt (with UUID) at GRUB, before I can even login.
I entered the password for the drive but I guess passphrase=/=password, this failed. I restored the backup fstab from a live cd, but now but I don't understand how to "edit /etc/fstab so that it mounts /dev/mapper/sdb_crypt in the right place." from RAOF's answer. Any ideas? And now I suspect I have more entries than I need in fstab, which to remove?