Moving Folders under /home/me to new drive

I have a similar setup, but slightly mofied to “scale better” in case I want to add another disk or another regular user at some point in the future. I’m a lazy, old man so I try to avoid extra work when ever I can. And yes, I try to keep things neat and organized. It helps with automation, as well.

The main difference is not to mount disks directly to /mnt but create a mountpoint under /mnt for each disk. That way you don’t have to change the permissions of /mnt directory itself and adding new disks is easy.

For similar reasons all regular users will have their own directory on the disk with permissions set to 700 (drwx------) so they cannot peek into other users’ directories.

Both /mnt and /mnt/data (disk mount point used in this example) are owned by root:root, permissions 0755/drwxr-xr-x .

Example: I have a disk I want to dedicate for Downloads etc.

I create a mountpoint for it under /mnt and add it to /etc/fstab:

$ sudo mkdir /mnt/data
$ sudo nano /etc/fstab

\# /mnt/data - /dev/sda4
UUID=<UUID-here> /mnt/data      ext4    rw,noatime,errors=remount-ro   0    0

I save and reboot.

After reboot I should see the disk mounted in /mnt/data. It has one directory (lost+found) in it, owned by root. I create a directory for user samuvuo, change it to be owned by samuvuo and change directory permissions to 700, so that only user samuvuo can access it (root has almighty powers anyway):

$ sudo mkdir /mnt/data/samuvuo
$ sudo chown samuvuo:samuvuo /mnt/data/samuvuo
$ sudo chmod 700 /mnt/data/samuvuo

I have some downloads already in the ~/Downloads directory, so I move it with its contents to the new location and create a symbolic link (shortcut) to the new location and place it in my home directory:

$ mv -v ~/Downloads /mnt/data/samuvuo/
$ ln -s /mnt/data/samuvuo/Downloads ~/Downloads

That should be it. (Although to be perfectly honest I move only directories that have little content. For larger directories or ones with really important files I use cp -avi or rsync, verify that all files got copied to the new place and only then remove the original.)

If I want to add another regular user and want their Downloads on the separate disk as well , I just repeat the steps for the new user (“otheruser”):

$ sudo mkdir /mnt/data/otheruser
$ sudo chown otheruser:otheruser /mnt/data/otheruser
$ sudo chmod 700 /mnt/data/otheruser
$ sudo mv /home/otheruser/Downloads /mnt/data/otheruser/
$ sudo ln -s /mnt/data/otheruser/Downloads /home/otheruser/Downloads
$ sudo chown otheruser:otheruser /home/otheruser/Downloads

The last step is purely cosmetic: the shortcut in user otheruser’s home directory is owned by root:root, but it can still be deleted by user otheruser.

Let’s say I want to add another disk, this time for media (Music and Videos). I just repeat the steps for adding a disk:

$ sudo mkdir /mnt/media
$ sudo nano /etc/fstab

\# /mnt/media - /dev/sda5
UUID=<UUID-here> /mnt/media      ext4    rw,noatime,errors=remount-ro   0    0

After reboot:

$ sudo mkdir /mnt/media/samuvuo
$ sudo chown samuvuo:samuvuo /mnt/media
$ sudo chmod 700 /mnt/media/samuvuo
$ mv ~/Music /mnt/media/samuvuo/
$ mv ~/Videos /mnt/media/samuvuo/
$ ln -s /mnt/media/samuvuo/Music ~/Music
$ ln -s /mnt/media/samuvuo/Videos ~/Videos
4 Likes