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
  • 33,360
  • I'm not sure what you want; I regularly re-install a system over another older GNU/Linux system, both making for example a Fedora or OpenSuSE system a Ubuntu system, keeping my old files (ie. /home) & setup (all configs etc), OR upgrade an older release (eg. 20.10 when it reached EOL) became a 21.10 system without losing my files, configs/setup etc. OR are you wanting to share /home between two OSes (that can be risky or problematic so I no longer do it!). Changing from one system to another doesn't require losing what was there beforehand with Ubuntu! but I'm not sure what you're asking. – guiverc Jan 28 '23 at 22:59
  • FYI: I'd answer @user68186 point first if that's what you want & get an answer he/she is willing to write (ie. make your /home point to HDD using live media etc), but I'll provide a link to https://askubuntu.com/questions/446102/how-to-reinstall-ubuntu-in-the-easiest-way/1451533#1451533 if you're interested in learning about re-install options... (It's very wordy sorry) though that detail is found 30+ times here on this site as I mention it often like prior comment. – guiverc Jan 28 '23 at 23:10
  • 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. – Will Steward Jan 29 '23 at 00:12
  • to userguiverc: thanks. I think that user68186 approach will probably work. To everyone: apologies for being too long and prolly riding roughshod over the forum protocols. – Will Steward Jan 29 '23 at 00:17
  • 1
    When adding additional details; please edit your question & add the additional or corrected detail there. This is a Q&A site & not a forum (https://ubuntuforums.org/ is where Ubuntu Forums are). Comments are intended to be just comments or questions/queries seeking clarification from the Original Poster (OP) and get deleted once addressed. Answers are to your initial question itself. (FYI: my mention of wordy was in relation to the link I provided & my opus or wordy answer... not your question; old[ish] & brain injury (me) aren't a great mix..) – guiverc Jan 29 '23 at 00:22
  • If the answer worked for you, don't forget to mark it as correct by clicking on the gray check mark ✓next to the answer and turn it green ✅. This will help others. If the answer didn't work, I would like to know and fix the answer if possible. – user68186 Feb 21 '23 at 21:36

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
  • 33,360