How to Resize an LXC Container Disk in Proxmox VE using ZFS
To change the disk size of an LXC container in Proxmox VE (PVE) using ZFS, you can follow these steps:
-
Stop the LXC container:
- Log in to the Proxmox VE web interface.
- Navigate to the 'LXC' tab and select the container you want to resize.
- Click on the 'Stop' button to stop the container.
-
Resize the ZFS dataset:
- SSH into the Proxmox VE server using an SSH client like PuTTY.
- Identify the ZFS dataset associated with the LXC container by running the following command:
zfs list ```
- Look for the dataset with a name similar to 'rpool/data/subvol-
/vm- -disk- '. - Resize the dataset using the following command:
zfs set volsize=
- Resize the virtual disk file:
- Locate the virtual disk file associated with the LXC container. The file is typically located in the '/var/lib/vz/images/
' directory. - Resize the virtual disk file using the following command:
- Locate the virtual disk file associated with the LXC container. The file is typically located in the '/var/lib/vz/images/
qm resize
-
Start the LXC container:
- Go back to the Proxmox VE web interface and start the LXC container.
-
Resize the filesystem inside the container:
- SSH into the LXC container using an SSH client.
- Resize the filesystem to use the newly allocated space. The commands to resize the filesystem vary depending on the filesystem type. Here are a few examples:
- For ext4:
- For ext4:
resize2fs /dev/sdaX
Replace 'X' with the partition number where the filesystem resides. - For XFS:
xfs_growfs /dev/sdaX
```
Replace 'X' with the partition number where the filesystem resides.
After following these steps, the disk size of the LXC container should be successfully changed.
原文地址: https://www.cveoy.top/t/topic/qx2o 著作权归作者所有。请勿转载和采集!