3

On my laptop (Dell Lattitude E7470) I have Ubuntu 16.04 installed on a btrfs partition (/dev/sda2) using the standard @ and @home subvolumes for / and /home mountpoints. There is also an EFI system partition (/dev/sda1). These are the only partitions in the system (I have no other OS installed). These are my partitions in /dev/sda as seen by gparted.

1

I want to install Ubuntu 20.04 over the current 16.04, but would like to keep my /home intact. (That is how I used to upgrade, but I used to keep /home on a separate ext4 partition, not a btrfs subvolume.)

Will the Ubuntu installer respect and keep my @home subvolume? When I select manual partitioning and specify /dev/sda2 as a btrfs partition, it is not clear that the installer is aware of the subvolumes.

1 Answer 1

4

Well, since I got no answers, I risked proceeding with the installation anyway. I'm reporting what I did, and the result, so it may help others and myself in the future.

What I did

  1. Before starting, make an external backup of the important stuff in /home, of course.
  2. Boot the live Ubuntu 20.04 from a USB flash drive, and chose "Try Ubuntu without installing".
  3. Mount /dev/sda2 btrfs partition on /mnt/
  4. Delete everything inside the /mnt/@/ root subvolume. (I previously made a btrfs snapshot of the subvolume, just in case something went wrong and I would have to restore the old system back. Fortunately this was not needed, but I'll keep the snapshot around for a while so I can compare configuration files in /etc, for instance.)
  5. Unmount mnt.
  6. Start the Ubuntu installer.
  7. On the "Installation type" window (see it on the tutorial), choose "Something else".
  8. On the partitioning window (a screenshot would be nice here), choose /dev/sda2 partition, specify mount point = / and no formatting. (There is no option for mount point /, /home, which would be clearer.)
  9. On the "Who are you" window (see it on the tutorial), enter a username equal to my previous main (uid=1000) username. (This should be optional, but this way the main user will immediately "inherit" the previous homedir from /home.)

The installation proceeded fine from then on.

Result

Upon reboot, the system started fine, both / and /home were mounted from the @ and @home subvolumes, as expected, and I logged in to my account with no issues.

Summary

Apparently the Ubuntu installer will keep the @ and @home subvolumes if it finds them on the brtfs filesystem, and will mount them as / and /home

If you want to overwrite the / volume, as I did, you should clear it first. I tried once without clearing, and the installation eventually failed.

2
  • I played a bit with this since I have a SSD about to fail: At step 4 I recursively deleted @ using rm -R. Then it wouldn't let me unmount /mnt. I tried to force unmount it but was unsuccessful. Then during the install there was no / to install 22.04 to. But I clicked on the "empty" partition and named it "/". Then ran the installer as you described. After it completed my old home folder was still there. BTW recursively deleting @ deleted an experimental btrfs subvolume that I had created, but left /home.
    – Russ Bain
    May 28 at 2:36
  • A deeper dive revealed that the experimental btrfs subvolume is still there. But its associated folder is gone.
    – Russ Bain
    May 28 at 2:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .