0

Hx: I've been using various Linux versions since about 2001, settling on Ubuntu in 2010. Around 2020 I moved to new hardware with a 0.5TB SSD and 1.0TB HD. I put /home on the HD and the rest of ubuntu 20.04 on the SSD. This December I had 700GB of photos, videos, music, etc in the /home partition. Then the system seemed to crash, or in my bumbling around I trashed it.

I did a standard re-install of 20.04.3, with all of its partitions on the SSD leaving the HD and its older /home untouched. Now I want to redefine /home to use the HD again. I know I could do another re-install and put the /home partition on the HD, but that would mean 16+ hours of reloading /home from backup. And I wouldn't learn anything from that approach.

Is there a way of redefining /home? While I once made a good living with GW-BASIC, Pascal, and Perl, that was at a time before most of you who read this were born. Now in my 75th year I'm intimidated by the hashmark prompt, and I'm not understanding the answers I've found when googling about this.

From Comments

I overwrote the old install with the new one. gparted reports this as dev/sdb2. The old /home partition is on dev/sda2. What I'm looking for is instructions on editing the /etc/fstab file.

user68186
  • 37,461

1 Answers1

2

Backup! Backup!! Backup!!!

Backup all your important files and folders. It seems you already have backups but this needs repeating for anyone who may be reading this answer later.

Find the UUID

UUIDs are Universally Unique IDentifiers. You need to find the UUD for the old /home partition. Open a terminal and enter:

sudo blkid

You will see a bunch of output among it you will find a line like:

/dev/sda2: UUID="26810f5a-83c7-4184-8bba-dafc9684fe73" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="bb712651-dcf5-4ca4-aac1-cd225fec9b7f"

Note the first part /dev/sda2. This should match the /home partition in the HDD. Copy the part that looks like UUID="26810f5a-83c7-4184-8bba-dafc9684fe73" and save it in a file. The actual numbers and letters of the UUID for you will be different. Do not copy the UUID from this answer.

Edit the /etc/fstab

Make a backup copy

Before editing the /etc/fstab make a backup copy:

sudo cp /etc/fstab /etc/fstab.original

Now if things go wrong you should be able to get back to the original fstab.

Edit the file

Open the file /etc/fstab in a text editor of your choice. You will need the sudo prefix or Edit as an Administrator option in the context menu. For example, you can use the nano editor:

sudo nano /etc/fstab

At the end of the file add a couple of lines like:

# /home was on /dev/sda2 during past installation
UUID=26810f5a-83c7-4184-8bba-dafc9684fe73 /home           ext4    defaults        0       2

The first line is a comment to remind you what the next line is for. Do not copy 26810f5a-83c7-4184-8bba-dafc9684fe73. Replace it with the UUID you have found and saved earlier.

Use Ctrl+O to save the changes followed by Ctrl+X to exit nano.

Restart your computer

If you have used the same username in your new installation as you did in your old installation, and if all went well, you should have your old /home back.

Hope this helps

user68186
  • 37,461