docs icon indicating copy to clipboard operation
docs copied to clipboard

Moving `/home` to secondary storage device

Open gangwerz opened this issue 4 years ago • 1 comments

I wrote a guide for a customer on how to place their home partition on their extra drive. This customer mentioned a preference for using a GUI, so this uses GNOME Disks for most of the tasks.

I would expand this guide with Terminal equivalents for those so inclined.

Maybe also look into moving home with a GUI and mention a GUI rsync client, to remove all the Terminal commands from the GUI section

Move /home to another storage device

  1. Rename the /home folder to anything else (I use /home-bak personally)

Terminal

sudo mv /home /home-bak
  1. Set the extradrive to mount to /home at boot. We are doing this now so the partition mounts to the correct location, /home

    GNOME Disks

    1. Find the drive in the list on the left, and select it

    2. Select the partition you want to be the home partition (likely the only partition) in the "Volumes" section

    3. Click the Gear icon below the partitions

    4. Turn off "User Session Defaults"

    5. Changes for using the drive as a home directory:

      • Mount at system startup -- Checked
      • Show in user interface -- Unchecked (If this is checked, you will see your home directory twice in the Files app)
      • Require additional authorization to mount -- Unchecked
      • Mount Point: /home
    6. Click "OK"

    7. Mount the new home partition to /home

    Press the Play button under the partitions listed in the "Volumes" section

  2. Copy the files from /home-bak to /home

I recommend using rsync here, as it will make sure the permissions and attributes for all the files are kept while copying your files. Without this, I have seen odd behavior from some applications when they are not copied with rsync

Make sure the first location ends with a /. This will copy the contents of /home-bak into /home. Without this trailing /, you will end up with the /home-bak folder copied into /home (e.g. /home/home-bak)

​sudo rsync -avhx  /home-bak/ /home
  1. Reboot your system to test that the changes are working

  2. Verify your data is present in the new, now current, home directory

  3. Delete /home-bak

Terminal

sudo rm -rf /home-bak

gangwerz avatar Dec 09 '21 16:12 gangwerz

grsync seems to be a good candidate for replacing step 3 with a GUI

gangwerz avatar Dec 09 '21 19:12 gangwerz