Score:0

Cloning to larger drive, resizing partion to fill

ml flag

I have an Ubuntu 20.04.3 system which started out as a curiosity and I used a 120 GB SSD I had laying around to build it. Then I started self hosting things on it (mostly Docker images) and now I'm at the point that I grew out the drive. I bought a new 1 TB SSD and I would like to clone the old drive to it and enlarge the partitions to fill it out.

My drive looks like this:

janos@ubuntubaiasprie:~$ sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL
NAME                      FSTYPE        SIZE MOUNTPOINT        LABEL
loop0                     squashfs     61.9M
loop1                     squashfs     43.6M
loop2                     squashfs     55.6M /snap/core18/2566
loop3                     squashfs       62M /snap/core20/1611
loop4                     squashfs     67.9M /snap/lxd/22526
loop5                     squashfs     67.8M /snap/lxd/22753
loop7                     squashfs       48M /snap/snapd/17336
loop8                     squashfs       48M /snap/snapd/17029
loop9                     squashfs     63.2M /snap/core20/1623
loop10                    squashfs     55.6M /snap/core18/2560
sda                                   111.8G
├─sda1                    vfat          512M /boot/efi
├─sda2                    ext4            1G /boot
└─sda3                    LVM2_member 110.3G
  └─ubuntu--vg-ubuntu--lv ext4         55.1G /

As a few hours of downtime is not a huge issue, I was thinking about booting from a live stick and running dd to clone the old drive to the new one.

But I don't know which partition to enlarge and what piece of software to use to enlarge it.

sudodus avatar
jp flag
You are using LVM, which makes it a bit more difficult to increase the size of the root partition. An alternative is to create a new **`data` partition** in the unallocated drive space and store things there. This is much easier, and should work (not for installed programs, but definitely for other kinds of files).
oldfred avatar
cn flag
I do not use LVM, but are you only using half of the partition. Default install typically does not use entire space so you can either resize or add volumes if desired. http://askubuntu.com/questions/852019/i-wish-to-expand-my-lvm2-partition & http://askubuntu.com/questions/196125/how-can-i-resize-an-lvm-partition-i-e-physical-volume I always suggest new install and restore from your normal backup. confirms backup is complete. Also any image copy will be an issue if you want to keep old drive as duplicate UUIDs not allowed.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.