Tuesday, March 25, 2008

Relocating the /home directory

Important: This only applies if you want to move the /home directory to another drive/partition, or if you want to activate an existing home directory on another drive/partition.

  1. Carefully write down these instructions since they require you to close the browser.
  2. Save and close all open programs, and then log out (as opposed to restart or shutdown).
  3. Press CTRL+ALT+F2; you will be taken to the TTY2 command line.
  4. Stop the Gnome Desktop Manager:
    sudo /etc/init.d/gdm stop
  5. (Note: Skip this step if you already have the contents of your /home directory in the desired partition.) Copy your /home directory to the desired partition, say /media/new_home_partition:
    sudo cp -pR /home/$USER /media/new_home_partition
    sudo chown $USER:$USER /media/new_home_partition/$USER
  6. Make the desired partition mount as /home:
    sudo cp /etc/fstab /etc/fstab.backup
    sudo nano /etc/fstab
    If the mount point for any entry is currently listed as /home, change it from
    # /dev/old_home_partition
    UUID=... /home ...
    to
    # /dev/old_home_partition
    UUID=... /media/old_home_partition ...
    Then set mount point for the desired partition's entry to /home by changing
    # /dev/new_home_partition
    UUID=... /media/new_home_partition ...
    to
    # /dev/new_home_partition
    UUID=... /home ...
    Save the file (i.e., press CTRL+O) and exit Nano (i.e., press CTRL+X).
  7. Press CTRL+ALT+DEL to reboot; after rebooting, your /home directory will be located in the new partition.

0 comments: