0

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.

  • 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. – PonJar Mar 04 '22 at 14:21
  • 1
    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 /. – oldfred Mar 04 '22 at 14:39
  • 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) – PonJar Mar 04 '22 at 14:40

1 Answers1

1

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

user68186
  • 33,360
  • All helpful stuff and thanks to everyone. – Twelve Kanaw Mar 04 '22 at 16:12
  • 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. – Twelve Kanaw Mar 04 '22 at 16:19
  • A quick pointer here please. I moved the home directory with not completely satisfactory results. It booted but there were some minor functions lost. I expect that the problem was that I didn't duplicate the home directory exactly. I don't want to use DD for this because I want to end up with different UUIDs. I need rsync to put everything in the new /home location, perfectly duplicating it but not pulling in stuff through symlinks (the -l option I think). How would you write the command? – Twelve Kanaw Mar 08 '22 at 00:28
  • Here's the rsync command I used: rsync -r -t -p -o -g -l --progress /home/ /media/myuser/newUUID Then changed fstab to mount newUUID at /home. It almost worked. – Twelve Kanaw Mar 08 '22 at 00:37
  • Sorry for the running saga. I probably solved this myself by thinking on it a bit. I added -H to preserve hard links and ran rsync as administrator and now the machine boots with /home in the new location and runs identically to the old location. I'll receive the new machine in a couple of days and clone the drive to wrap this up. Any comments are still welcome and interesting to read. Thanks. – Twelve Kanaw Mar 08 '22 at 01:26
  • 1
    The conclusion of all this, for anyone who wants to know, is that it worked 100%. I had to get the contents of home copied correctly to a new partition. I ended up keeping separate / and /home partitions. Cloned the entire drive with dd. Stuck it in the new machine. Bingo. It was almost anti climactic. Thanks for the discussion, everyone. – Twelve Kanaw Mar 11 '22 at 14:47
  • @TwelveKanaw It may be a good idea to summarize all your comments to an answer with the final solution. As I reread your comments it is a bit unclear if you used rsync and then dd or tried one and then the other. In this site the comments are mainly for clarifications. Sometimes the site admins remove long chains of comments or move them to chat. – user68186 Mar 11 '22 at 15:45