This guide covers migrating a plain-partition Debian root filesystem to LVM and extending it with a second disk (Netcup Local Block Storage). The end result is a single root filesystem spanning both disks.
- A Netcup VPS or Root Server running Debian with a plain (non-LVM) root partition
- A Local Block Storage volume attached via Netcup SCP (will appear as
/dev/vdb) - Access to Netcup SCP to activate rescue mode
- Boot into rescue mode
- Set up LVM on the new disk and copy root to it
- Update fstab, regenerate initramfs, reinstall GRUB
- Boot into the new LVM root
- Add the old disk to the VG for full combined capacity
In Netcup SCP, navigate to your server and attach the Local Block Storage volume.
In Netcup SCP, shut down the server, then go to Media (left sidebar) → click the Rescue System tab in the top-right corner of the page → activate the rescue system. The server will start automatically in rescue mode.
apt-get install -y lvm2
pvcreate /dev/vdb
vgcreate vg0 /dev/vdb
lvcreate -l 100%FREE -n root vg0
mkfs.ext4 /dev/vg0/rootmkdir /mnt/old /mnt/new
mount /dev/vda3 /mnt/old
mount /dev/vg0/root /mnt/new
rsync -aAX --info=progress2 --exclude={"/proc/*","/sys/*","/dev/*","/run/*"} /mnt/old/ /mnt/new/--info=progress2 shows overall transfer progress (total size, speed, ETA).
For a 2TB disk expect this to take 20–30+ minutes.
sed -i "s/$(blkid -s UUID -o value /dev/vda3)/$(blkid -s UUID -o value /dev/vg0/root)/" /mnt/new/etc/fstab
cat /mnt/new/etc/fstabMount /boot and bind-mount the required virtual filesystems, then chroot:
mount /dev/vda2 /mnt/new/boot
for d in dev dev/pts proc sys run; do mount --bind /$d /mnt/new/$d; done
chroot /mnt/new /bin/bashInside the chroot:
apt-get install -y lvm2
update-initramfs -u -k all # -k all ensures every installed kernel gets LVM support
update-grub
grub-install /dev/vda
exitUnmount everything:
umount -Rl /mnt/newIn Netcup SCP, go to Media → Rescue System and deactivate the rescue system, then start the server.
pvcreate -y /dev/vda3
vgextend vg0 /dev/vda3
lvextend -l +100%FREE /dev/vg0/root
resize2fs /dev/vg0/rootVerify:
df -h /