Increase Virtual Disk Size of An Image - Documentation For Clear Linux Project
Increase Virtual Disk Size of An Image - Documentation For Clear Linux Project
The first method is to boot up your VM and execute the lsblk command as shown below:
bash
lsblk
Console
1 di 5 12/09/2023, 15:29
Increase Virtual Disk Size of an Image — Documentation for Clear L... https://www.clearlinux.org/clear-linux-documentation/guides/mainten...
The second method to look at the image configura�on YAML file that was used to produce the image.
For example, to find the size of the KVM image version number 31880, follow these steps:
1. Go to the releases repository.
2. Drill down into the 31880 > clear > config > image directory.
3. Download and open the kvm.yaml file.
4. Locate the targetMedia sec�on.
The example shows a total disk size of 8.54 GB, 512 MB for the EFI par��on, 32 MB for the swap
par��on, and 8 GB for the root par��on.
Console
1 targetMedia:
2 - name: ${bdevice}
3 size: "8.54G"
4 type: disk
5 children:
6 - name: ${bdevice}1
7 fstype: vfat
8 mountpoint: /boot
9 size: "512M"
10 type: part
11 - name: ${bdevice}2
12 fstype: swap
13 size: "32M"
14 type: part
15 - name: ${bdevice}3
16 fstype: ext4
17 mountpoint: /
18 size: "8G"
19 type: part
1. Log in.
2. Open a terminal window.
3. Add the storage-u�ls bundle to install the parted and resize2fs tools.
2 di 5 12/09/2023, 15:29
Increase Virtual Disk Size of an Image — Documentation for Clear L... https://www.clearlinux.org/clear-linux-documentation/guides/mainten...
bash
bash
sudo parted
Console
Fix/Ignore?
c. Enter resizepart <par��on number> where <par��on number> is the number of the par��on to
modify.
d. Enter the new End size.
Note
If you want a par��on to take up the remaining disk space, then enter the total size of the
disk. When you print the par��ons table with the p command, the total disk size is shown
a�er the Disk label.
e. Enter q to exit parted when you are finished resizing the par��on.
Figure 1 depicts the described steps to resize the par��on of the virtual disk from 8.5 GB to 30
GB.
3 di 5 12/09/2023, 15:29
Increase Virtual Disk Size of an Image — Documentation for Clear L... https://www.clearlinux.org/clear-linux-documentation/guides/mainten...
1. Enter sudo resize2fs -p /dev/<modified par��on name> where <modified par��on name> is the
par��on that was changed in the parted tool.
2. Run lsblk to verify that the filesystem size has increased.
Figure 2 depicts the described steps to resize the filesystem of the virtual disk from 8.5 GB to 30
GB.
4 di 5 12/09/2023, 15:29
Increase Virtual Disk Size of an Image — Documentation for Clear L... https://www.clearlinux.org/clear-linux-documentation/guides/mainten...
5 di 5 12/09/2023, 15:29