I messed up. My main OS partition ( / ) is running out of space frequently, and I want to transfer my existing system to another disk. with different size partitions.
I have a 2 Tbyte disk, but when I partitioned it for the initial install, I messed up and created my OS partition 20 GB, with the /home partition at 1.8 TB.
I’ve had to delete tmp files and an application or two in order to get it back working.
I’ve ordered a new drive to transfer everything to, which will be partitioned differently. I plan on making the OS area more like 50 GB, unless someone suggests otherwise.
I have way too much data to lose to a complete reformat and reinstall, so I’d like to get recommendations for a program or procedure to transfer from the old disk to the new one. Preferably with good instructions, I’ve forgotten a lot of the subtleties of various commands due to not using them for so long.
From your figures you have ~200 gig free maybe show fdisk -l
If you copy files from one drive to another you will have to deal with different UUID labels on the partition which will mess up your booting until you fix in /etc/fstab You also must deal with grub. (EFI or MBR boot??). You can not just copy files and expect things to work. Your data is all on home partition so why not just install on the new drive using correct sizes and just copy your data. reinstalling apps is quick and easy
Assuming you used BTRFS formatting 20 gig is way to little. Default is 40 gig and is the min recommended. 50 is fine.
Disk /dev/sda: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x000b1475
Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 4208639 4206592 2G 82 Linux swap / Solaris
/dev/sda2 * 4208640 46153727 41945088 20G 83 Linux
/dev/sda3 46153728 3907028991 3860875264 1.8T 83 Linux
File system is extfs4 , it was the default at the time it was first installed, hence the size.
sda2 is the / directory, and sda3 is the /home directory.
If I understand your suggestion; I install from scratch on the new drive (to appropriately sized partitions), then transfer the data to the new /home, right?
What’s the best way to transfer the data? There are multiple accounts on the Linux system: (myself, wife, and son). Do I just transfer the contents of the /home directories, or is there a recommended tool to do so?
What works for me here is to keep the home directory during the new install. You can do this by creating your partitions in the new disk before install and cloning just the separate home partition to the new disk - this is different than cloning the whole disk, which would recreate same-sized partitions with raw space at the end.
For root I save /etc/fstab (after changing disk id from UUID to device or label on the old system), /etc/exports and a backup of the full /etc folder, but not to overwrite the new one, just to check and eventually copy some config files I forgot to separate beforehand.
If you just copy the home folder before installation you may loose things like auth files, fifo’s and other esoteric stuff I barely understand.
If you overwrite the home folder after installation, you may run into some issues too, although I don’t have experience with this.
AFAIU, to transfer the whole system increasing the root partition, IME it is easier to clone the partitions up to root (do not include subsequent partitions), resize the root partition and manually create the subsequent partitions with a gparted live disk, and then clone each remaining partition one by one, so the new disk partition sizes are not changed. Or perhaps just create each partition with gparted and then clone root, home and others one by one. Clonezilla should be able to do this, check it’s documentation.
If your / filesystem is ext4 and you want to change it to btrfs - which was a bit confusing initially but did save my bacon by reverting a snapshot when I had a KDE upgrade gone wrong - you’ll obviously need to make a new install, keeping your /home as is if you don’t want to change it’s filesystem too.
If after cloning the partition revert to it’s original size (I’m not sure about this), you’ll simply end with raw space after the partition. Just use gparted to extend it.
The documentation for Clonezilla seems to suggest that it won’t clone to a partition smaller than the original. I have a lot of real estate available on my /home, but I can’t shrink the original, from what partd and fdisk seem to indicate.
remove the old one install a new system. add the old drive back copy the files from old home to new home
Reinstall any additional programs if you miss a few just install them when you discover a missing program… Bonus is you get rid of stuff you never use
This is the safest and easiest way
It appears that you use MBR/Legacy boot. If you have an UEFI (BIOS) then I recommend install using EFI boot But that is not necessary. I also recommend creating a second root partition just not mounted to be used with the next version of OS this allows testing before committing to the new OS and gives a very good fall back if needed
You said “Relevant portion of fdisk -l :”
Please always show all output since hiding stuff makes proper recommendations harder