How to replace the main disk of a Proxmox server?

ManelRB

New Member
Oct 17, 2024
3
0
1
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
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!