If you want to clone an install to a bigger disk, without reinstalling, this is possible.
I did this with Fedora 40 Kinoite, LUKS encrypted.
I used a Clonezilla flashdrive I had laying around, load to RAM, exit to shell. But you can also use a live Fedora install medium.
If the system you are cloning is the one you use, close as many running programs, disable internet, disable background services (syncthing, nextcloud, VPN, …). But this is not recommended!
A: Use Clonezilla
This is very easy. You can follow this guide.
For flashing Clonezilla to a pendrive/usb-stick, you can use Fedora-Media-Writer, KDE IsoImageWriter, Impression or dd
(instead or UnetBootin).
- Choose “load to RAM”
- Choose “clone local disk to local disk” (make sure both drives are connected securely)
- During clone, choose “proportionally -k1” to automatically use the new size
Do get Clonezilla, go to their download page and select “iso”. If you are on an AMD or Intel Computer, choose “amd64”.
If you use very recent hardware (newer than 3 years), you may want to use the “alternative” version, which uses Ubuntu instead of Debian, supporting more recent hardware and nonfree drivers.
After using Clonezilla, skip to step 4 below.
B: Manual Way
This is manual, you can learn something and it works if for whatever reason Clonezilla does not work.
1. Clone the drive
This is dangerous, be sure to check the commands!
Make sure all the drives are connected securely.
# list block devices
lsblk
# here my devices are "sda" and "nvme0n1"
# clone the drive
sudo dd if=/dev/sda of=/dev/nvme0n1 status=progress && sync
2. Resize the partition table
The issue is, that after the dd
also the partition table is cloned. The partitions cannot be enlarged, there is no free space shown.
To fix this, you need to recreate the partition table bit-by-bit using the exact numbers.
A misalignment will result in data loss.
Use gdisk
to do this.
sudo gdisk /dev/nvme0n1
# list partitions, this is critical, take a photo!
p
# delete table and all partitions and recreate table
o
# create new partitions
n # default start sector, define end sector, Code EF00 (EFI)
n # default start sector, define end sector, default Code 8300 (Linux Filesystem)
n # default start and end sectors, default Code 8300
# write changes
w
Turn off the device
shutdown now
3. Boot into destination disk
Start the device again, boot into the newly cloned system.
In a GUI partiton manager you can see the free space left. The last partition, default to be storage, can just be resized to max.
4. Resize the BTRFS partition to max
sudo btrfs filesystem resize max /
# tells me it worked
# repeat to see the new size, it worked
5. BTRFS care
sudo btrfs balance start /
sudo btrfs filesystem defragment -r -v /