diff --git a/source/clear-linux/guides/maintenance/figures/increase-virtual-disk-size-1.png b/source/clear-linux/guides/maintenance/figures/increase-virtual-disk-size-1.png index db5a2f3f..a4692c9a 100755 Binary files a/source/clear-linux/guides/maintenance/figures/increase-virtual-disk-size-1.png and b/source/clear-linux/guides/maintenance/figures/increase-virtual-disk-size-1.png differ diff --git a/source/clear-linux/guides/maintenance/figures/increase-virtual-disk-size-2.png b/source/clear-linux/guides/maintenance/figures/increase-virtual-disk-size-2.png new file mode 100644 index 00000000..90b1eb28 Binary files /dev/null and b/source/clear-linux/guides/maintenance/figures/increase-virtual-disk-size-2.png differ diff --git a/source/clear-linux/guides/maintenance/increase-virtual-disk-size.rst b/source/clear-linux/guides/maintenance/increase-virtual-disk-size.rst index 7b991faa..0436d965 100644 --- a/source/clear-linux/guides/maintenance/increase-virtual-disk-size.rst +++ b/source/clear-linux/guides/maintenance/increase-virtual-disk-size.rst @@ -1,126 +1,169 @@ .. _increase-virtual-disk-size: -Increase Clear Linux image virtual disk size -############################################ +Increase virtual disk size of a Clear Linux\* image +################################################# -Prebuilt |CLOSIA| images come in different sizes, ranging from 300 MB to 20 +|CLOSIA| prebuilt images come in different sizes, ranging from 300 MB to 20 GB. This guide describes how to increase the size of your prebuilt |CL| image if you need more capacity. -Determine the prebuilt image size -********************************* +.. contents:: This guide will cover: -There are two methods to find the virtual disk size of your prebuilt |CL| -image. +Determine the partition order and sizes of the prebuilt image +*************************************************** -The first method is to check the config.JSON file of the image, located in the -`releases`_ repository. For example, to find the size of the Hyper-V\* image -version number 20450, follow these steps: +There are two methods to find the order and sizes of partitions virtual disk +of your prebuilt |CL| image. -#. Go to the `releases`_ repository. -#. Drill down into the `20450 > clear > config > image` directory. -#. Open the :file:`hyperv-config.json` file. -#. Locate the `PartitionLayout` key. - The example shows 512 MB for the EFI partition, 32 MB for the swap - partition, and 8 GB for the root partition. +In both examples, the prebuilt Hyper-V image has a disk size of 8.5 GB with / +dev/sda3 being the partition for the root filesystem (/) - .. code-block:: console +Checking :command:`lsblk` on the VM +----------------------------------- - "PartitionLayout" : [ { "disk" : "hyperv.img", - "partition" : 1, - "size" : "512M", - "type" : "EFI" }, - { "disk" : "hyperv.img", - "partition" : 2, - "size" : "32M", - "type" : "swap" }, - { "disk" : "hyperv.img", - "partition" : 3, - "size" : "8G", - "type" : "linux" } ], - -The second method is to boot up your :abbr:`VM (Virtual Machine)` and +The first method is to boot up your :abbr:`VM (Virtual Machine)` and execute the :command:`lsblk` command as shown below: .. code-block:: bash - sudo lsblk + sudo lsblk -An example output: +An example output of the :command:`lsblk` command: .. code-block:: console - NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT - sda 8:0 0 8.5G 0 disk - ├─sdd1 8:1 0 512M 0 part - ├─sdd2 8:2 0 32M 0 part [SWAP] - └─sdd3 8:3 0 8G 0 part / + NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT + sda 8:0 0 8.5G 0 disk + ├─sda1 8:1 0 512M 0 part + ├─sda2 8:2 0 32M 0 part [SWAP] + └─sda3 8:3 0 8G 0 part / -In this example, both methods show the prebuilt Hyper-V image is about 8.5 GB. +An example of this can also be seen in Figure 1. + +Checking :file:`config.json` used to build the image +---------------------------------------------------- + +The second method to determine partition to check the :file:`config.json` +file used to create prebuilt image, located in the `releases`_ repository. +For example, to find the size of the Hyper-V\* image version number 20450, +follow these steps: + +#. Go to the `releases`_ repository. +#. Drill down into the `20450 > clear > config > image` directory. +#. Open the :file:`hyperv-config.json` file. +#. Locate the `PartitionLayout` key. + + The example shows 512 MB for the EFI partition, 32 MB for the swap + partition, and 8 GB for the root partition. + + + .. code-block:: console + + "PartitionLayout" : [ { "disk" : "hyperv.img", + "partition" : 1, + "size" : "512M", + "type" : "EFI" }, + { "disk" : "hyperv.img", + "partition" : 2, + "size" : "32M", + "type" : "swap" }, + { "disk" : "hyperv.img", + "partition" : 3, + "size" : "8G", + "type" : "linux" } ], Increase virtual disk size ************************** +Once you have determined the disk and partition to be increased, you are +ready to perform the actual increase of the disk, partition, and filesystem. -To increase the virtual disk size for a prebuilt image, perform the steps below: +Power off VM and increase virtual disk size: +-------------------------------------------- -#. Shut down your VM if it is running. -#. Use an appropriate hypervisor tool to increase the virtual disk size of - your VM. -#. Power up the VM. -#. Log in to an account with root privileges. -#. Open a terminal emulator. -#. Add the |CL| `storage-utils` bundle to install the `parted` and - `resize2fs` tools. +To increase the virtual disk size for a prebuilt image, perform the steps +below: - .. code-block:: bash +#. Shut down your VM if it is running. +#. Use the process defined by your hypervisor + or cloud provider to increase + the virtual disk size of your |CL| VM. +#. Power up the VM. - sudo swupd bundle-add storage-utils -#. Launch the `parted` tool. +Resize the partition of the virtual disk: +----------------------------------------- - .. code-block:: bash +#. Log in to an account with root privileges. +#. Open a terminal emulator. +#. Add the |CL| `storage-utils` bundle to install the + :command:`parted` and :command:`resize2fs` tools. - sudo parted + .. code-block:: bash -#. In the `parted` tool, perform these steps: + sudo swupd bundle-add storage-utils - #. Press :command:`p` to print the partitions table. - #. If the warning message below is displayed, enter :command:`Fix`. +#. Launch the `parted` tool. - .. code-block:: console + .. code-block:: bash - Warning: Not all of the space available to /dev/sda appears to be - used, you can fix the GPT to use all of the space (an extra ... - blocks) or continue with the current setting? + sudo parted - Fix/Ignore? +#. In the `parted` tool, perform these steps: - #. Enter :command:`resizepart [partition number]` where - *[partition number]* is the partition number to modify. - #. Enter :command:`yes` when prompted. - #. Enter the new `End` size. + #. Press :command:`p` to print the partitions table. + #. If the warning message below is displayed, enter :command:`Fix`. - .. note:: + .. code-block:: console - If you want a partition to take up the remaining disk space, then - enter the total size of the disk. When you print the partitions - table with the :command:`p` command, the total disk size is shown - after the `Disk` label. + Warning: Not all of the space available to /dev/sda appears to be + used, you can fix the GPT to use all of the space (an extra ... + blocks) or continue with the current setting? - #. Enter :command:`q` to exit `parted` when you are finished resizing the - image. + Fix/Ignore? -#. Enter :command:`sudo resize2fs -p /dev/[modified partition name]` where - *[modified partition name]* is the partition that was changed in `parted`. + #. Enter :command:`resizepart [partition number]` where + *[partition number]* is the partition number of the partition to modify. + #. Enter :command:`yes` when prompted. + #. Enter the new `End` size. -Figure 1 shows how to increase the size of a |CL| Hyper-V image from 8.5 -GB to 20 GB. Before the steps shown in Figure 1, we used the Hyper-V Manager -to increase the VM virtual disk size from 8.5 GB to 20 GB. + .. note:: -.. figure:: figures/increase-virtual-disk-size-1.png - :scale: 100 % - :alt: Increase root partition size example + If you want a partition to take up the remaining disk space, then + enter the total size of the disk. When you print the partitions + table with the :command:`p` command, the total disk size is shown + after the `Disk` label. - Figure 1: Increase root partition size example. + An example of this can be seen in Figure 1. -.. _releases: https://download.clearlinux.org/releases/ + #. Enter :command:`q` to exit `parted` when you are finished resizing the + image. + + Figure 1 depicts the described steps to resize the partition of the virtual disk from 8.5GB to 20GB. + + .. figure:: figures/increase-virtual-disk-size-1.png + :scale: 100 % + :alt: Increase root partition size + + Figure 1: Increase root partition size. + +Resize the filesytem +-------------------- + +#. Enter :command:`sudo resize2fs -p /dev/[modified partition name]` where + *[modified partition name]* is the partition that was changed in `parted`. + +#. Run the :command:`df -h` to verify that the filesystem size has + increased. + + Figure 2 depicts the described steps to resize the partition of the virtual disk from 8.5GB to 20GB. + + .. figure:: figures/increase-virtual-disk-size-2.png + :scale: 100 % + :alt: Increase root filesystem with resize2fs + + Figure 2: Increase root filesystem size after partition has been expanded. + +Congratulations! You have resized the disk, partition, and filesystem. At +this point, the increase in disk capacity is usable. + +.. _releases: https://download.clearlinux.org/releases/ \ No newline at end of file