Please click here if you are not redirected within a few seconds.
Moving /home › shanebow.com
Moving /home
Linux Users & Groups Tips & Tricks

Access the Root Shell

Grub Prompt

Getting a grub> prompt instead of the menu usually means you pressed Esc too late, or held it too long, which triggered the GRUB command-line interface instead of the visual menu.

How to get back to the menu

If you are currently at the grub> prompt, you don't need to restart yet:

Tips for UEFI Systems

TTY Session

If your machine boots fine, you don't need the GRUB Recovery Mode or a root shell to move your /home directory. Instead, you can switch to a TTY (Teletype) session, which is a full-screen terminal outside the GUI environment. Step 1: Switch to a TTY Session

Moving Home

To a new partition

Step 1 First switch to TTY Session

Step 2: Prepare the New Partition

Identify your new partition (e.g., /dev/sdb1) using lsblk.
Create a temporary mount point and mount the new drive:
sudo mkdir /mnt/newhome
sudo mount /dev/sdb1 /mnt/newhome 

Step 3: Copy Your Data Use rsync to move your files while preserving permissions and ownership: sudo rsync -aXS --progress /home/. /mnt/newhome/. Step 4: Update /etc/fstab

Get the UUID of your new partition:
blkid /dev/sdb1
Back up and edit your fstab file:
sudo cp /etc/fstab /etc/fstab.bak
sudo nano /etc/fstab
Add a line at the end to mount the new partition as /home:
UUID=your-uuid-here /home ext4 defaults 0 2 

Step 5: Switch Over

Rename your old home directory to keep it as a backup:
cd / && sudo mv /home /home_old
Create a new empty /home folder to act as the mount point:
sudo mkdir /home
Reboot your system:
sudo reboot 

Once you've confirmed everything works and your files are present, you can safely delete /home_old to free up space.

Merge with existing partition

To merge your current /home into your /data partition and then remount /data as the new /home, follow these steps. This process assumes /dev/sda (the 1TB drive) is currently mounted at /data and you want to keep the existing /data files while adding the contents of your current /home to it. Step 1: Switch to a TTY Session To avoid data corruption, do this outside of your GUI session:

Press Ctrl + Alt + F3 at the login screen or desktop.
Log in as your normal user.

Step 2: Merge /home Content into /data Since /data is already mounted, you can copy your current home files directly into it. We will use rsync to preserve permissions.

Stop all user processes:
sudo systemctl stop display-manager (This will kick you out of the GUI if you weren't already).
Synchronize home files to the data drive:
sudo rsync -aXS --progress /home/ /data/
Note: After this, your /data partition will contain all your user folders (e.g., /data/yourusername) alongside whatever was already there. 

Step 3: Update /etc/fstab to Swap Mount Points Now you need to tell Linux that /dev/sda should be mounted as /home instead of /data.

Find the UUID for /dev/sda:
blkid /dev/sda (Identify the partition UUID, usually sda1).
Back up and edit fstab:
sudo cp /etc/fstab /etc/fstab.bak
sudo nano /etc/fstab
Modify the lines:
    Find the line that currently mounts your 1TB drive to /data.
    Change the mount point from /data to /home.
    It should look something like this:
    UUID=your-uuid-here /home ext4 defaults 0 2
Save and exit (Ctrl+O, Enter, Ctrl+X). 

Step 4: Finalize the Switch

Move the old home directory so it doesn't conflict with the new mount point:
sudo mv /home /home_old
Create a new empty mount point:
sudo mkdir /home
Apply changes:
sudo mount -a. 

Step 5: Verify and Cleanup

Check that the 1TB drive is now your home:
df -h /home
Log back into your GUI. If everything looks correct, you can later delete the old home folder on your 128GB drive:
sudo rm -rf /home_old 

Caution: Your old /data files will now be located at the root of your /home directory (e.g., /home/your_old_data_folder). If you prefer them to be inside your user folder, you can move them manually once logged back in. Do you have any specific folders or applications on the /data drive that might have hardcoded paths you need to update?

how do I boot ubuntu into root Drop to root shell prompt?

To boot into a root shell prompt on Ubuntu, you must access the GRUB menu during the startup process and enter Recovery Mode. Steps to Access the Root Shell

Restart your computer.
Access the GRUB menu:
    BIOS/Legacy: Press and hold the Shift key immediately after the manufacturer logo disappears.
    UEFI: Press the Esc key repeatedly until the menu appears.
Navigate to Advanced options: Use the arrow keys to select Advanced options for Ubuntu and press Enter.
Select Recovery Mode: Highlight the entry for your kernel that ends with (recovery mode) and press Enter.
Drop to root shell: Once the Recovery Menu appears, use the arrow keys to scroll down and select root (Drop to root shell prompt), then press Enter.
Enable Write Access (Optional): By default, the filesystem is mounted as read-only. To make changes, run the following command:
mount -o remount,rw / 

Troubleshooting

Why did the TTY login fail?

I have an efi boot partition and after pressing esc repeatedly I get a 'grub>' prompt? What did I do wrong?

Getting a grub> prompt instead of the menu usually means you pressed Esc too late, or held it too long, which triggered the GRUB command-line interface instead of the visual menu. How to get back to the menu If you are currently at the grub> prompt, you don't need to restart yet:

Type normal and press Enter.
Immediately tap Esc once or twice.
The standard GRUB menu (with "Advanced options") should appear. 

Tips for UEFI Systems

The "One-Tap" Rule: For UEFI systems, Ubuntu documentation suggests tapping Esc repeatedly, but hitting it too many times often drops you straight into that command prompt. Try to time a single press right as the manufacturer logo disappears.
Alternative Command: If normal doesn't work, type exit and press Enter. Depending on your firmware, this might reboot or attempt to load the next boot entry, which is often the menu.
Manual Booting: If you are stuck at the prompt because the menu is broken, you can manually load the kernel using commands like ls to find your partition, followed by linux /vmlinuz... and initrd /initrd..., though this is much more complex. 

Are you trying to reach the root shell to reset a password or because the system won't boot normally?

Actually I am trying to move my /home directory to another partition on a larger drive and wanted to be out of the gui environment to go through the process - the machine boots fine.

Since your machine boots fine, you don't need the GRUB Recovery Mode or a root shell to move your /home directory. Instead, you can switch to a TTY (Teletype) session, which is a full-screen terminal outside the GUI environment.

Step 1: Switch to a TTY Session

Step 2: Prepare the New Partition

Step 3: Copy Your Data

Use rsync to move your files while preserving permissions and ownership:

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

Step 4: Update /etc/fstab

Step 5: Switch Over

Once you've confirmed everything works and your files are present, you can safely delete /home_old to free up space.

let me explain a bit more: I have ubuntu installed on a partition of a 128GB hdd (dev/sdb) and a second 1TB hdd (dev/sda) currently mounted as /data. How can I make the /data be the /home directory and merge the current /data directories with the /home directory contents?

To merge your current /home into your /data partition and then remount /data as the new /home, follow these steps. This process assumes /dev/sda (the 1TB drive) is currently mounted at /data and you want to keep the existing /data files while adding the contents of your current /home to it.

Step 1: Switch to a TTY Session

To avoid data corruption, do this outside of your GUI session:

Step 2: Merge /home Content into /data

Since /data is already mounted, you can copy your current home files directly into it. We will use rsync to preserve permissions.

Note: After this, your /data partition will contain all your user folders (e.g., /data/yourusername) alongside whatever was already there.

Step 3: Update /etc/fstab to Swap Mount Points

Now you need to tell Linux that `/dev/sda should be mounted as /home instead of /data.

Find the UUID for /dev/sda: blkid /dev/sda (Identify the partition UUID, usually sda1).

Back up and edit fstab: sudo cp /etc/fstab /etc/fstab.bak sudo nano /etc/fstab Modify the lines: Find the line that currently mounts your 1TB drive to /data. Change the mount point from /data to /home. It should look something like this: UUID=your-uuid-here /home ext4 defaults 0 2 Save and exit (Ctrl+O, Enter, Ctrl+X).

Step 4: Finalize the Switch

Move the old home directory so it doesn't conflict with the new mount point:
sudo mv /home /home_old
Create a new empty mount point:
sudo mkdir /home
Apply changes:
sudo mount -a. 

Step 5: Verify and Cleanup

Check that the 1TB drive is now your home:
df -h /home
Log back into your GUI. If everything looks correct, you can later delete the old home folder on your 128GB drive:
sudo rm -rf /home_old 

Caution: Your old /data files will now be located at the root of your /home directory (e.g., /home/your_old_data_folder). If you prefer them to be inside your user folder, you can move them manually once logged back in.

Do you have any specific folders or applications on the /data drive that might have hardcoded paths you need to update?

Keeps telling me incorrect login when I try to switch to TTY session - what is the risk of just doing this in a normal terminal ? In this cas would I skip the "sudo systemctl stop display-manager"?

The risk of doing this from within a GUI terminal is active file usage. If you are logged in, your browser, desktop environment, and background services are constantly writing to your home directory (caches, config files, sockets). If you move or rename /home while these files are open, your session will likely crash, freeze, or suffer data corruption. The "incorrect login" on TTY is usually because the NumLock is off (if you use a keypad) or you are trying to log in as root instead of your standard username. If you absolutely must do this from within the GUI, follow this modified "safe-ish" path:

1. The "Live-Swap" Strategy (No TTY)

2. A Better Alternative: Use a Live USB

If the TTY login is failing, the safest way is to boot from a Ubuntu Live USB.

Identify and Mount Your Drives

You need to mount your 128GB SSD (system) and your 1TB HDD (data) to temporary folders in the live environment.

*Create Mount Points:

~~~bash

sudo mkdir /mnt/system sudo mkdir /mnt/data_drive

Use code with caution.
Mount the Drives:

* Perform the rsync and edit the fstab on the SSD from there. * This way, zero files are in use, and there is no risk of a crash.

Would you like the specific commands to clean up the hidden "old home" files after you reboot and confirm the 1TB drive is working?

Build the path to sovereignty with open source

Canonical supports sovereign AI by enabling organizations to deploy and operate open source AI infrastructure in environments that guarantee control, enhance security, and ensure compliance: