# Move /home Folder

tags
  #Linux
published
  January 29, 2025
reading time
  2 minutes

You can move the `/home` folder on Ubuntu, but you must do it carefully to avoid breaking your system. Below are the steps to safely move `/home` to a new location.

## 1. Create a Backup (Recommended)

Before proceeding, create a backup of your home folder in case anything goes wrong.

    sudo tar -czvf /home_backup.tar.gz /home

## 2. Create a New Partition or Mount Point (If Needed)

If you’re moving /home to a different partition or disk, make sure it’s properly formatted and mounted.

For example, if you want to use a new disk (e.g., `/dev/sdb1`):

    sudo mkfs.ext4 /dev/sdb1
    sudo mkdir /mnt/newhome
    sudo mount /dev/sdb1 /mnt/newhome

## 3. Copy the Home Folder

Copy all user data to the new location while preserving permissions:

    sudo rsync -aXS /home/ /mnt/newhome/

## 4. Update fstab

Edit /etc/fstab to mount the new home directory at boot.

    sudo nano /etc/fstab

Add this line at the end (adjust the path accordingly):

    /dev/sdb1  /home  ext4  defaults  0  2

If you prefer using the UUID, first find it:

    sudo blkid

Then, add this line instead:

    UUID=your-uuid /home ext4 defaults 0 2

## 5. Unmount Old Home and Mount New One

Switch to a different session (e.g., TTY):

    Ctrl + Alt + F3

Log in and stop processes using `/home`:

    sudo systemctl stop gdm  # For GNOME (or use sddm/lightdm if applicable)

Unmount and remount:

    sudo umount /home
    sudo mount /home

## 6. Verify and Reboot

Check that everything is in place:

    ls /home

If everything looks good, reboot:

    sudo reboot

# Things to Keep in Mind

- If you’re logged in as a regular user, switch to a root shell (sudo -i) or use a temporary user with administrative privileges.

- If you face permission issues, you might need to reapply ownership:

    sudo chown -R username:username /home/username