Copy 1tb --> 512gb

Hi.

I have successfully upgraded from ubuntu 22.04 to ubuntity unity 24.04 by doing a ‘fresh’ install, copying my home directory over, and install all my apps. This took a long time, but well worth the effort. The ‘new’ system is infinitely faster, and ‘cleaner’.

The old ubuntu 22.04 is on a 512gb SATA and uses roughly 400gb over 6
partitions (formatted as gpt).

The new ubuntu unity 24.04 is on a 1tb SATA and uses roughly 400gb over the same sized 6 partitions (formatted as gpt).

Okay, so you guessed it:

I want to copy all of the new data to the smaller SATA, and of course it has to be bootable. There is lotsa room data wise, but how to deal with booting, and the gpt table which is at the end of each SATA ??

I suppose I could gparted copy each partition from the 1tb source to the 512gb destination - but I’m pretty sure the 512gb won’t boot.

Would ‘dd’ copying the 1st 446 bytes of the source to the destination work?

What is the best way to do this ?

Thanks,
M…

You do not mention if you have a physical container for the second drive or can your PC support two drives. I have worked perfectly well with external docking bay (StarTech) with two caddies, each containing SSD. I replaced my old internal SATA drive with SSD (for Windows). As grub manager I use rEFInd. The external two SSD drives connect via USB 3.0 for speed. You can create a boot partition 500Mb in first partition in each SSD with rEFInd installed in each. So you can separately boot up your SSD’s.

You cannot have duplicate UUIDs, so if booting with both drives you cannot clone or image copy partitions. I always suggest new install & restore from backup. I use rsync. You can clone if not rebooting with both drives and want to use drive with another system. I have never done it, but many suggest clonezilla or fsarchiver.

You say new install took a long time. What was the issue?
While I have done it multiple times, it only takes me about an hour. New install, restore data, reinstall apps from dpkg list or script. I do run a couple of scripts to change some settings if I do not copy /home. I then want to experiment with different settings .

Thanks guys.

The 24.04 ubuntu unity is on a 1tb ESATA, and I have twin 512gb internal SATAs.

I have had a bad experience with clonezilla (maybe a finger problem), so I will look into fsarchiver or refind.

What took me so long is that I have a lot of Apps.

I ran into problems trying to get Classic Menu Indicator working.

It took a lot of searching to find a copy of dlume, and the version I found has a problem with not releasing a lock file.

I still can’t get wine32 to work (wine64 is fine).

I still haven’t figured out why my screen dims slightly after I log in (I’m running a desktop not a laptop).

It took me a while to get my wireless networks to display.

Virtual Machine 7.0 no longer ‘sees’ a usb - when I plug in a usb the host ‘grabs’ it first.

And then there was this:
Ubuntu Unity 24.04 is on SDA2. After I was up and running, I decided I
wanted to backup the Ubuntu Unity partition.

I booted with a gparted usb, allocated a 200gb partition sda7, and copied sda2 to sda7.

Then I booted the ESATA Ubuntu Unity 24.04. Then I spent quite a bit of time getting all my Apps installed.

At that point I decided to do another backup. So I booted the gparted usb, and copied SDA2 —> SDA7.

Then I booted the ESATA Ubuntu Unity 24.04 only to find all my updates were gone!!

It took me a while, but I realized that after the first gparted copy, the ESATA was booting SDA7!!

All the work I did was then happening on SDA7, and of course when I later backed up SDA2 —> SDA7, I lost it all.

I still don’t understand why the ESATA booted SDA7 ???

Fortunately I logged all my efforts, so I could reconstruct what I did.

Now I’ve learned to do the backup to a usb. I didn’t do this initially because my old desktop doesn’t support usbc, and the backup took forever.

Well you asked…

Thanks for all your help, and have a nice day.
M…

I bet it booted sda7 as it has same UUID. While fstab & grub are main places where UUID must be unique a copy may have UUIDs in several other places.

From old install

dpkg --get-selections > ~/my-packages

From New install

sudo dpkg --set-selections < my-packages
sudo apt-get -y update
sudo apt-get dselect-upgrade
#IF you get this error:
dpkg: warning: package not in database
sudo apt-get install dselect
sudo dselect
→ Update
→ Install

My backup script includes export of app list, so always current this also. The dpkg list is a very long text list of all applications and the dependencies.
If upgrading, you may want to edit it to remove obsolete, old kernels or others. It will not re-install anything already installed.

https://help.ubuntu.com/community/ReinstallingSamePackages
https://www.debian.org/doc/manuals/debian-handbook/sect.apt-get.en.html

I now created a script to install the main apps I want. I only have 3 or 4 per line as if new version does not have that app entire line fails.

Another that just lists manually installed apps.
apt-mark - show, set and unset various settings for a package, an install list must have the install on the line, the showmanual just lists the apps, but you can convert to a install file with sed

apt-mark showmanual | sort -u
apt-mark showmanual > user-installed.list
sed -i “s/$/\tinstall/” user-installed.list

I have many USB flash drives (lived close to a Microcenter), but upgraded desktop with new larger M.2 drive and put old SSD into M.2 to USB adapter. Now use external SSD for most things as so much faster.