Skip to content

Commit d4ce780

Browse files
Geoffroy Van Cutsemdbkinder
authored andcommitted
doc: update the instructions to increase the size of a UOS disk image
Update the instructions on how to increase the size of a UOS disk image so that the entire operation can be performed on the development host. This has the advantage that it can be done completely offline (the UOS must be powered off in fact) and no extra tools need to be installed in the UOS to do this. Signed-off-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
1 parent 80dc2c8 commit d4ce780

File tree

1 file changed

+58
-15
lines changed

1 file changed

+58
-15
lines changed

doc/tutorials/increase-uos-disk-size.rst

Lines changed: 58 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@ broken down into three steps:
1818
#. Resize the ``rootfs`` partition
1919
#. Resize the filesystem
2020

21-
Increase the virtual disk size
22-
******************************
23-
2421
.. note::
2522

26-
This step **must** be performed while the User OS (UOS) is powered off.
23+
These steps are performed directly on the UOS disk image. The UOS VM **must**
24+
be powered off during this operation.
25+
26+
Increase the virtual disk size
27+
******************************
2728

2829
We will use the ``qemu-img`` tool to increase the size of the virtual disk
2930
(``uos.img``) file. On a Clear Linux system, you can install this tool using:
@@ -49,23 +50,65 @@ As an example, let us add 10GB of storage to our virtual disk image called
4950
You can choose any increment for the additional storage space. Check the
5051
``qemu-img resize`` help for more information.
5152

52-
Now that you have increased the size of the virtual disk, power up the Virtual
53-
Machine (VM) before moving to the next steps.
54-
5553
Resize the ``rootfs`` partition
5654
*******************************
5755

58-
Follow the `Resize the partition of the virtual disk <https://clearlinux.org/
59-
documentation/clear-linux/guides/maintenance/increase-virtual-disk-size#resize-
60-
the-partition-of-the-virtual-disk>`_ section to resize the partition hosting the
61-
UOS rootfs (typically ``/dev/sda3``).
56+
The next step is to modify the ``rootfs`` partition (in Clear Linux, it is
57+
partition 3) to use the additional space available. We will use the ``parted``
58+
tool and perform these steps:
59+
60+
* Enter the ``parted`` tool
61+
* Press ``p`` to print the partition tables
62+
* A warning will be displayed, enter ``Fix``
63+
* Enter ``resizepart 3``
64+
* Enter the size of the disk (``19.9GB`` in our example)
65+
* Enter ``q`` to quit the tool
66+
67+
Here is what the sequence looks like:
68+
69+
.. code-block:: none
70+
71+
$ parted uos.img
72+
73+
.. code-block:: console
74+
:emphasize-lines: 5,7,9,19,20
75+
76+
WARNING: You are not superuser. Watch out for permissions.
77+
GNU Parted 3.2
78+
Using /home/gvancuts/uos/uos.img
79+
Welcome to GNU Parted! Type 'help' to view a list of commands.
80+
(parted) p
81+
Warning: Not all of the space available to /home/gvancuts/uos/uos.img appears to be used, you can fix the GPT to use all of the space (an extra 20971520 blocks) or continue with the current setting?
82+
Fix/Ignore? Fix
83+
Model: (file)
84+
Disk /home/gvancuts/uos/uos.img: 19.9GB
85+
Sector size (logical/physical): 512B/512B
86+
Partition Table: gpt
87+
Disk Flags:
88+
89+
Number Start End Size File system Name Flags
90+
1 1049kB 537MB 536MB fat16 primary boot, esp
91+
2 537MB 570MB 33.6MB linux-swap(v1) primary
92+
3 570MB 9160MB 8590MB ext4 primary
93+
94+
(parted) resizepart 3
95+
End? [9160MB]? 19.9GB
96+
(parted) q
6297
6398
Resize the filesystem
6499
*********************
65100

66-
Follow the `Resize the filesystem <https://clearlinux.org/documentation/
67-
clear-linux/guides/maintenance/increase-virtual-disk-size#resize-the-filesytem>`_
68-
section to resize the filesystem to use the entire storage capacity.
101+
The final step is to resize the ``rootfs`` filesystem to use the entire
102+
partition space.
103+
104+
.. code-block:: none
105+
106+
$ LOOP_DEV=`sudo losetup -f -P --show uos.img`
107+
$ PART_DEV=$LOOP_DEV
108+
$ PART_DEV+="p3"
109+
$ sudo e2fsck -f $PART_DEV
110+
$ sudo resize2fs -p $PART_DEV
111+
$ sudo losetup -d $LOOP_DEV
69112
70113
Congratulations! You have successfully resized the disk, partition, and
71-
filesystem or your User OS.
114+
filesystem of your User OS.

0 commit comments

Comments
 (0)