how to change disk size of a lxc in pve which 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-<CTID>/vm-<CTID>-disk-<DISKID>. - Resize the dataset using the following command:
Replacezfs set volsize=<SIZE> <DATASET><SIZE>with the desired size (e.g., 10G for 10 gigabytes) and<DATASET>with the dataset name from the previous step.
-
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/<CTID>directory. - Resize the virtual disk file using the following command:
Replaceqm resize <CTID> <DISKID> <SIZE><CTID>with the container ID,<DISKID>with the disk ID (usually 0 for the root disk), and<SIZE>with the desired size.
- Locate the virtual disk file associated with the LXC container. The file is typically located in the
-
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:
Replaceresize2fs /dev/sdaXXwith the partition number where the filesystem resides. - For XFS:
Replacexfs_growfs /dev/sdaXXwith the partition number where the filesystem resides.
- For ext4:
After following these steps, the disk size of the LXC container should be successfully changed
原文地址: http://www.cveoy.top/t/topic/iR2G 著作权归作者所有。请勿转载和采集!