1

I have an Ubuntu Server 20.04 machine running with a long-running memory-intensive data processing script running. I would like to replace my old hard drive with a new, larger hard drive.

Is it possible to hibernate the system, copy the old drive to the new, swap the drives, and then un-hibernate the system?

My plan would be systemctl hibernate (first verifying swapon --show returns a swap file), power off, unplug the old hard drive, copy (using CloneZilla) the old hard drive to the new hard drive on another machine (or maybe using a bootable USB OS on the same machine), plug in the new hard drive, and then power on the machine.

Will this work?

mark
  • 241

1 Answers1

0

Hibernating Swap while Cloning Disk

I tried this using a USB flash drive as all my HDD's are in use.

  • Created Full install USB using sudodus 20.04 image file.
  • Enlarged swapfile to 5GB.
  • Set up hibernation.
  • opened a bunch of programs.
  • Invoked hibernation.
  • Created an image file of the flashdrive using Gnome-Disks*.
  • Zeroed the flash drive using mkusb.
  • Flashed the image to the flash drive using mkusb.
  • Returned the flash drive to it's original socket.
  • It booted to it's state at the time of hibernating.

This may be a little different than your case with a server, but it proves that your premise works.

I do think it is important to plug the new disk into the same SATA port the old disk was plugged into at time of hibernation.

*A pro would use dd and clone disk to disk, but Disks and mkusb give a level of comfort.

C.S.Cameron
  • 20,530
  • 12
  • 78
  • 125