Score:0

How to unify /home and /, placing home back into the root partition, clone the drive and put it in a new machine?

cn flag

I've bought a new machine. This --> Move separate /home partition to the default configuration /home folder is the first part of what I want to do - I think.

The new machine is a NUC and has one drive only. The old machine has /home and / on different drives. This is the way the original installation was configured. Using the above, I can put them onto the same drive. Then clone it to the new, larger drive. Then stick it in the new machine.

First - will this even work? Linux is surely more friendly to this scheme than Windows but that doesn't mean it will wake up like Frankenstein with a new brain and go forth to do my bidding.

If it seems likely to work, is it better to put /home back in the default location on / or to make a second partition on the same drive with / and put it there?

Thanks for looking.

PonJar avatar
in flag
You can definitely do this. Make sure you do your research first. There are plenty of relevant tutorials online and answered questions on here. You imply that you can connect the new machines drive to the old machine. In that case I would copy all the partitions on the old machines system disk to the new disk. Then I would resize the system partition on the new disk. Next I would copy home to the home folder of the new disk using rsync. You should also edit fstab on the new disk and hash out the entry for /home.
oldfred avatar
cn flag
I would just do a new install to NUC and then rsync /home into new install. You really should do a restore from your normal backup which would also include a list of installed apps, /home, any other data & if server apps installs those folders in /.
PonJar avatar
in flag
Regarding /home on a separate partition or not, there is no answer that is optimal for every case. It’s argued that with a separate partition you can reinstall the rest of the system more easily. That is not 100% correct because /home contains lots of application configuration that will carry over to the new installation. I much prefer a single partition. You don’t have to guess how much space to allocate to separate / and /home partitions. When you get that wrong you have to resize and that is an unnecessary pain. (But perfectly doable)
Score:0
ar flag

First - will this even work?

It depends. Here I will discuss the issues with cloning a system partition (mountpoint /) to a new disk.

BIOS to BIOS

If your old computer has an old legacy BIOS and MBR you will want your new NUC to boot in the legacy mode. You will also want to initialize the internal disk in the NUC with MBR and not GPT.

In these systems part of grub is written inside the MBR. When you clone the / partition to the new disk, the MBR is not copied as it is not part of that partition. You will have to re-install grub in the new disk using a live USB. Otherwise the NUC won't boot.

UEFI to UEFI

If your old computer has UEFI and GPT, you will want to have the same in your NUC and initialize the internal disk in the NUC with GPT.

In these systems part of grub is written in a special partition called EFI System Partition (ESP). You will need to clone the ESP and the / partitions to the new disk. Just cloning the / partition will not work.

BIOS to UEFI

If your old computer has BIOS and the NUC's UEFI does not have a Legacy/CSM boot setting then cloning the / won't work. It is possible to convert from BIOS/MBR setup to UEFI/GPT setup, but it is complicated and I won't recommend it.

It will be easier to freshly install Ubuntu in the NUC.

A Note on UUIDs and /etc/fstab

Partitions are identified by UUIDs for mounting in the file /etc/fstab in Ubuntu. If the cloning process changes the UUID of the cloned partition then you will have to edit /etc/fstab to reflect that change.

Many tutorials ask you to change the UUID while (or after) cloning a partition. This is because you shouldn't have two partitions (in different disks) with the same UUID in the same computer. You may not want to change the UUIDs in the new disk if you never (I mean never) reboot your old computer with both the new and the old disks connected.

Home partition or folder?

Is it better to put /home back in the default location on / or to make a second partition on the same drive with / and put it there?

The answer to this is purely opinion based. If you are happy with the current setup, you may have a separate partition for /home. I don't see why you can't clone the existing /home partition from the second disk of the old computer to the new disk of the NUC after cloning the / and possibly the ESP partitions.

Since the partitions are identified by their respective UUIDs, it does not matter if the /home partition is in the same physical disk or in a different physical disk. As long as the UUIDs in the partitions match their references in the /etc/fstab Ubuntu should find the /home in the separate partition and boot properly.

On the other hand if you want to keep /home in the default location inside the / partition, that is fine too.

Disclaimer

Many years ago I went through the same process of moving the OS and /home partition from my old desktop to a NUC. In my case, it was "BIOS to UEFI" and my attempts to cloning the /home partition failed. I ended up Installing Ubuntu and using rsync to copy the contents of the /home partition from the old disk to the new disk.

I have not tried the "BIOS to BIOS" and the "UEFI to UEFI" cloning. So, I may have missed something and they may not work as described above.

Hope this helps

Twelve Kanaw avatar
cn flag
All helpful stuff and thanks to everyone.
Twelve Kanaw avatar
cn flag
I should have said that I'm using UEFI on both machines. I boot the old machine with rEFInd. What I thought of first to do was to follow the tutorial for moving the home directory, either back into / or a separate partition on the same drive and, once that's running ok, clone the _entire drive_ , which would take in the EFI partition and all. There may be a BIOS setting to change to point to rEFInd. Or I might need to run the rEFInd installation script again, which added the boot entry flawlessly when I installed it to begin with. Going by the answers here, this has a good chance of success.
ar flag
@TwelveKanaw let me know how it goes and if you want me to change anything in the answer based on your experience. Or you may want to write your own answer.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.