How to migrate a VM to a smaller disk while preserving all data using Clonezilla, to optimize Linstor DRBD storage usage in a Proxmox cluster.
<!--truncate-->
:::danger MANDATORY BACKUP
**Before any manipulation, create a complete backup of your VM** via Proxmox Backup Server or `vzdump`. This operation directly manipulates disks and any error can result in data loss.
📚 A detailed article on Proxmox Backup Server is coming soon.
:::
## Context
My production Ubuntu VM from the [Current Homelab](/docs/homelab-actuel) has a **400 GB** disk on Linstor DRBD storage. This oversized disk comes from a time when this OS ran directly on bare-metal before virtualization.
### Problem
After reducing the system partition to **130 GB** (leaving 270 GB of unallocated free space), I want to:
1. Create a new **135 GB** disk (130 GB of data + 5 GB margin)
2. Migrate the OS and data to this smaller disk
3. Free up **265 GB** on Linstor DRBD storage
### Final Goal
Reorganize Proxmox hosts storage:
- **300 GB**: Linstor DRBD (highly available replicated storage)
- **200 GB**: local-lvm (non-replicated local storage)
## Prerequisites
### Required Tools
- **Proxmox VE**: Virtualization hypervisor
- **Clonezilla Live ISO**: Disk cloning tool ([download](https://clonezilla.org/downloads.php))
- **Linstor DRBD**: Distributed storage (see [article on Proxmox distributed storage](/blog/stockage-distribue-proxmox-ha))
### Initial VM State
Before starting, check the current state:
```bash
sudo fdisk -l /dev/sda
```
**Expected output**:
- Disk `/dev/sda`: **400 GiB**
- System partition (`/dev/sda3`): **~120 GiB** used
- Free space: **~270 GiB** unallocated
:::tip Shrink partition beforehand
If you haven't shrunk your partition yet, use `gparted` or `resize2fs` to reduce the filesystem **before** starting this procedure. Leave about 5 GB margin compared to used space.
:::
## Step 1: Create the New Disk in Proxmox
In the Proxmox web interface, access your VM configuration:
1. Select your VM
2.**Hardware** tab
3. Click **Add** → **Hard Disk**
**New disk configuration**:
- **Storage**: `linstor_storage` (or your Linstor DRBD pool)
- **Disk size**: `135 GiB`
- **Bus/Device**: `SCSI` (scsi1)

:::info
The new disk will appear as `/dev/sdb` in the VM. The original disk `/dev/sda` remains in place for now.
[×] -k0 Create partition table in target disk proportionally
```
**Explanation**: This option recreates the partition table while keeping **original sizes** of partitions (not resizing them proportionally to the new disk).
#### Option 2: `-icds` (Skip checking destination disk size)
```
-icds, --skip-check-dest-size
[×] -icds Skip checking destination disk size before creating partition table
```
**Explanation**: By default, Clonezilla refuses to clone to a disk **smaller** than the source disk. This option disables this check.
:::tip Why does it work?
Even though the destination disk (135 GB) is smaller than the source disk (400 GB), the **used partitions** are only 130 GB. Clonezilla clones only the partitions, not the unallocated empty space.
The `-k0` option ensures partitions keep their original size (130 GB) instead of being resized proportionally to the new disk.
:::
### Start Cloning
1. Validate all options
2. Clonezilla displays a **summary** of parameters
3. Confirm with **`y`** then **Enter**
4. Confirm a second time to start cloning

**Estimated duration**: Between 10 and 30 minutes depending on data amount and Linstor DRBD storage speed.
## Step 5: Configure Boot on New Disk
Once cloning is complete:
1.**Shut down the VM** via Proxmox
2. Return to **Hardware** → **Options** → **Boot Order**
3.**Disable** CD-ROM (or remove ISO)
4. Make sure **scsi1** (new 135 GB disk) is in **first position**
5.**Start the VM**
### Boot Verification
The VM should boot normally on the new disk. Connect and verify:
```bash
sudo fdisk -l
```

Only delete the old disk after **validating proper operation** of the VM for at least 24 hours. In case of problems, you can roll back.
:::
Once the VM is stabilized:
1.**Shut down the VM**
2. In Proxmox: **Hardware** → Select **Hard Disk (scsi0)** (400 GiB)
3. Click **Remove**
4. Confirm deletion
**Result**: 265 GB freed on Linstor DRBD storage! 🎉
## My Use Case: Proxmox Storage Reorganization
In my case, this operation allowed me to free up 265 GB on Linstor DRBD storage. With this reclaimed space, I can now repartition my physical disks on Proxmox hosts to optimize storage usage:
└── local-lvm: 200 GiB (non-replicated local storage)
```
This reorganization allows me to better utilize resources:
- **Replicated storage** (Linstor DRBD - 300 GB): For critical VMs requiring high availability
- **Local storage** (local-lvm - 200 GB): Primarily for my Kubernetes VMs that manage distributed storage themselves via Longhorn, as well as some test VMs/LXCs
## Conclusion
Clonezilla allows efficient VM migration to a smaller disk, provided you:
1.**Shrink partitions beforehand** to leave free space
2. Use **KVM To RAM** mode to avoid display issues
3. Enable `-k0` and `-icds` options in Expert mode
This technique allowed me to free **265 GB** on my Linstor DRBD storage, optimizing Proxmox cluster resource usage and enabling more flexible storage reorganization.