Replace boot drive

Ralf Mardorf kde.lists at yahoo.com
Tue May 14 15:49:05 UTC 2024


On Mon, 2024-05-13 at 12:36 -0500, Jack McGee wrote:
> What is best course to backup existing boot drive to new boot drive, 
> make new boot drive the boot drive?

Hi,

does the computer provide another port, so that you can connect both
drives?

If so, boot into a live Ubuntu flavour media, mount the old drive, so
that you can't format the old drive by accident, run

  sudo gparted

format the new drive, then mount the new drive, too and run

  sudo cp -Tai /mnt/old_drive/ /mnt/new_drive/; echo $?

or

  sudo cp -Tai /medie/ubuntu_flavour/old_drive/ /mnt/media/ubuntu_flavour/new_drive/; echo $?

depending on the way you mounted the drives. Most safe is to mount the
old drive read only, but you not necessarily need to do it.

If the "boot" drive has got more than one partition for a Linux install,
you need to do this for all partitions, excepted of swap partitions.

If messages mention to be unable to copy special files, such as sockets,
you can ignore those messages, as long as, echo $? returns 0.

Backup strategies are a topic on their own.

When the copy is done, you need to restore the bootloader. How to do
this depends.

Note! If you have got several ports, but no free port, then temporarily
disconnect a drive, to connect the new drive and the old "boot" drive.

This is the way I usually migrate a Linux from one drive to another
drive. OTOH I sometimes restore an old install from a backup, to a new
drive.

I usually make backups either by using

sudo cp -Tai ...

or by using

sudo tar --xattrs -czf ...

Regards,
Ralf




More information about the ubuntu-users mailing list