How to replace the main disk of a Proxmox server?

ManelRB

New Member
Oct 17, 2024
8
6
3
Good evening,

First of all, I'm here to introduce myself. I haven't seen the typical thread for doing so.

I'm quite a novice with Proxmox. I've been using it for a little over a year and I have a fairly modest installation on a small OptiPlex 7050.

The thing is that I installed it on a 256GB SATA SSD and now it's just enough for the LXC containers I'm using ;-)

I'd like to replace it with a larger disk without losing the information but I haven't found information (or I haven't been able to search well enough) on what the official procedure is to do so.

The file system I use is a simple ext4, I don't have ZFS.

What should I do? Would it be a matter of cloning the disk using Clonezilla or something similar? In that case, how would the partitions created during the installation be enlarged proportionally?

Thanks to everyone and sorry if this topic has already been discussed before.
 
I still have a question.

The system disk is /dev/sdb and it is partitioned like this:

- /dev/sdb1 (BIOS Boot, 1007KB)
- /dev/sdb2 (EFI System, 1GB vfat, mounted on /boot/efi)
- /dev/sdb3 (Linux LVM, 213GB)

I understand that, after cloning onto the 1TB disk, I should extend the /dev/sdb3 partition so that it occupies the rest of the disk until the end of it.

But my question is what happens with the different volume groups or logical volumes that Proxmox has created within the physical volume.

That is, PV = /dev/sdb3.
VG = pve
There are several LVs, e.g. lv_root, lv_home, etc.

Do I have to worry about the contents of the partition at the Proxmox level? Or is cloning the disk and then expanding the partition enough?

I have never expanded an LVM partition and I don't know how it works.

Thanks.
 
I've continued to investigate and I'm still not sure what to do with logical volumes.

I understand that logical volumes corresponding to disks in a VM or LXC should not be resized.

But what about logical volumes root, swap, data, etc. For example, the output of the lvs command on my Proxmox is the following:

1729787354495.png

I understand that the process would be:

- Clone disk with Clonezilla to maintain partition structure
- Extend the /dev/sdb3 partition using gparted or fdisk to use the entire disk
- Extend the physical volume: pvresize /dev/sdb3
- The volume group will now use all the space on the physical volume
- But what about logical volumes? I can't use commands like lvextend -l +100%FREE /dev/mapper/pve-root because this would take up the entire disk. I would have to think about what extension to do on each of the LVs.
- And it also seems that I would have to use resize2fs /dev/mapper/pve-root to extend the ext4 filesystem that it has

I'm a bit lost with all this. Sorry if the questions are obvious for those who are familiar with the subject.
 
Yes, that sounds all totally ok, yet I don't know why you need to resize swap and root. Those don't benefit from more space automatically, only if you ran out of space there. LVM is normally used for VM/CT disk images, so you just can create more VM/CTs or expand the VM disks via the GUI.
 
1. Clone the Disk (with dd or clonezilla)

2. Bios Boot and EFI can stay the way they are, you have to grow sdX3 (might be another letter than b on the new disk).
You can use parted (i dont know the syntax for that) or fdisk
fdisk /dev/sdb

Use (p) to print partition layout
Use (d) to delete partition 3
Use (n) to create new partition 3 (same beginning sector as before, new last sector)
Use (t) to set type to LVM (not strictly neccessary)
Use (w) to write partition, KEEP THE LVM SIGNATURE
Use (q) to quit fdisk

3. Use pvresize /dev/sdb3 to resize the physical Volume

4. Use vgextend to extend your volume group

Now your volume group has more (unused) space, you can extend your containers in the gui or with pct resize CTID neccessary
 
Hi everyone,

First of all, happy new year!

Secondly, I was able to buy a new, larger NVME drive and an external enclosure so I could clone the small drive using Clonezilla.

I then used GParted to extend the partition to the maximum and everything seems fine. The GParted/Proxmox combination made the PV and VG expand automatically (I didn't have to use pvresize or vgextend).

Before using Clonezilla (original disk):

1735734816261.png

Before using GParted (cloned disk), the partition looked like this:

1735734837092.png

After using GParted (cloned disk), it was expanded:

1735734858275.png

Now, I still need to expand the storage pool "local-lvm" that is inside the volume group "pve".

How do I do that?

1735734782779.png
1735734907898.png

Thanks.
 
Last edited:
  • Like
Reactions: Kingneutron
You should be aware, if you ever have to reinstall Proxmox - the PVE ISO will wipe the target drive.

So it makes sense to separate OS + data on separate disks, and have backups. If you can install proxmox OS onto SATA SSD and have the nvme for VMs, that might be more ideal long-term.
 
  • Like
Reactions: waltar and ManelRB
lvextend -l +100%FREE pve/data
Many thanks @waltar,

I wasn't sure about that command and first I tried to expand it with a few GB. It worked fine ;-)

Code:
root@pve:~# lvextend -L +100G pve/data
  Size of logical volume pve/data_tdata changed from <123.24 GiB (31549 extents) to <223.24 GiB (57149 extents).
  Logical volume pve/data successfully resized.

Thanks for the help. I'm going to clean up all the notes to document the process.
 
Well, after all the Christmas holidays and before going back to work, I've had some time to document this change.

Here's a link to the original article (in Spanish):
https://www.manelrodero.com/blog/reemplazo-del-disco-de-sistema-de-proxmox

And to an automatic translation using Google Translate that's not bad at all:
https://www-manelrodero-com.transla..._sl=es&_x_tr_tl=en&_x_tr_hl=en&_x_tr_pto=wapp

In case it helps anyone who comes across this question.

Thanks again to everyone who has helped me.
 
Well, after all the Christmas holidays and before going back to work, I've had some time to document this change.

Here's a link to the original article (in Spanish):
https://www.manelrodero.com/blog/reemplazo-del-disco-de-sistema-de-proxmox

And to an automatic translation using Google Translate that's not bad at all:
https://www-manelrodero-com.transla..._sl=es&_x_tr_tl=en&_x_tr_hl=en&_x_tr_pto=wapp

In case it helps anyone who comes across this question.

Thanks again to everyone who has helped me.
Thanks Manel, I just used your guide to replace my system disk and I've bookmarked your guide for future use.
 
  • Like
Reactions: nikeman and ManelRB
Well, after all the Christmas holidays and before going back to work, I've had some time to document this change.

Here's a link to the original article (in Spanish):
https://www.manelrodero.com/blog/reemplazo-del-disco-de-sistema-de-proxmox

And to an automatic translation using Google Translate that's not bad at all:
https://www-manelrodero-com.transla..._sl=es&_x_tr_tl=en&_x_tr_hl=en&_x_tr_pto=wapp

In case it helps anyone who comes across this question.

Thanks again to everyone who has helped me.
Incredible guide. Thanks Manel! Just followed this to replace my tiny system disk with a larger one. No issues!
 
  • Like
Reactions: ManelRB
I'm so glad the guide is helpful for those who, like me, started with a small drive ;-)

PS: Sorry I didn't write it in English; I'm not very good with texts longer than a sentence.
 
Well, after all the Christmas holidays and before going back to work, I've had some time to document this change.

Here's a link to the original article (in Spanish):
https://www.manelrodero.com/blog/reemplazo-del-disco-de-sistema-de-proxmox

And to an automatic translation using Google Translate that's not bad at all:
https://www-manelrodero-com.transla..._sl=es&_x_tr_tl=en&_x_tr_hl=en&_x_tr_pto=wapp

In case it helps anyone who comes across this question.

Thanks again to everyone who has helped me.
This guide SAVED me from hours of reinstalling a tiny ribbon cable in a HP EliteDesk G4 Pro that I have been using as a Proxmox node for 4+ years now. I went from 1TB SSD for local storage to a 4TB NVMe.

The ONLY thing that I had to do differently was at the end in the Extend the storage pool section - when entering the command:
Code:
lvextend -L +100%FREE pve/data
I got the following error:
Code:
Can't parse size argument.

Invalid argument for --size: 100%FREE

Error during parsing

So after some research, I discovered that in Proxmox VE v8.3, I had to enter this code instead:
Code:
lvresize -l +100%FREE /dev/pve/root
Notice the lowercase "L" and the different path. Then to expand the local storage to include the additional 3TB, I entered:
Code:
resize2fs /dev/mapper/pve-root

Hopefully this helps save someone else some troubleshooting time in their homelab (or at work if the Broadcom acqusition of VMware brought your here :))
 
Last edited: