Virtual Hard Disk Size Increase

Get more disk space. Increase the size of a virtual disk. Expand virtual machine storage capacity. Possible with Qubes, Kicksecure-Qubes, Kicksecure KVM, and Kicksecure VirtualBox.
Overview
[edit]Note: When you increase the size of a virtual disk on the host, the additional space will not necessarily become available automatically inside the virtual machine (VM). Claiming the new space is required.
In summary, the following steps are required to grow the disk.
1 Back up important data.
2 On the host operating system (OS): Increase the size of the virtual disk.
3 Restart the virtual machine.
4 Inside the virtual machine (VM): At the grub boot menu, make a temporary kernel boot parameter change by setting bdev_allow_write_mounted=1 to allow claiming the new space.
Elaborated below.
5 Inside the VM: Claim the new space.
6 Inside the VM: Reboot.
7 Done.
Virtual Machines
[edit]If more disk space is required for virtual hard disks, the good news is that this is simple for Kicksecure VMs. Nothing special is required, because it is just another VM image. Any suggestions found for your virtualizer will similarly work for Kicksecure. Self Support First Policy applies.
1 Back up important data.
Either move important files via shared folders [1] or make a full clone of VMs in each snapshot state in case something goes wrong.
2 Select your virtualizer.
VirtualBox
3 On the host:
4 Make a clone of all states of any existing virtual machine in case something goes wrong.
5 Delete all existing VM snapshots.
6 Grow the disk.
Either,
- A Using the VirtualBox graphical user interface (GUI):
VirtualBox → File → Tools → Virtual Media Manager → select virtual hard disk → adjust the size slider
or,
- B Using the command line interface (CLI). See footnote. [2]
7 During VM boot:
8 Restart the virtual machine and stop at the grub boot menu.
9 At the boot menu, boot into persistent mode - sysmaint session and make a Temporary Kernel Boot Parameter Change by changing bdev_allow_write_mounted=0 to bdev_allow_write_mounted=1 for this boot only. [3]
10 Inside the VM:
11 Inspect Kernel Command Line.
Optional. For verification of kernel boot parameter change.
cat /proc/cmdline | grep --color bdev_allow_write_mounted
Expected output:
bdev_allow_write_mounted=1
12 Version-specific notice.
- Build Version
17.4.0.5and above: No special notice. - Older build versions: See footnote. [4]
13 Reboot.
14 Done.
The procedure is complete.
KVM
3 On the host:
4 Delete all existing snapshots.
5 Increase the disk size.
1G below should be replaced with the amount of disk space to be added in gigabytes.
qemu-img resize vmdisk.img +1G
6 During VM boot:
7 Restart the virtual machine and stop at the grub boot menu.
8 At the boot menu, boot into persistent mode - sysmaint session and make a Temporary Kernel Boot Parameter Change by changing bdev_allow_write_mounted=0 to bdev_allow_write_mounted=1 for this boot only. [5]
9 Inside the VM:
10 Inspect Kernel Command Line.
Optional. For verification of kernel boot parameter change.
cat /proc/cmdline | grep --color bdev_allow_write_mounted
Expected output:
bdev_allow_write_mounted=1
11 Follow the same version-specific instructions as in the VirtualBox section to claim the new space.
12 Reboot.
13 Done.
The procedure is complete.
Build from Source Code
[edit]Refer to Build Kicksecure from Source Code and use this command line parameter:
--vmsize 200G
See Also
[edit]Footnotes
[edit]- ↑
- ↑
Find the folder of the virtual hard disk.
Run the following command. Notes:
- Adjust the filename of the virtual hard disk.
- Adjust
100000to, for example,200000.
- ↑ Alternatively, advanced users can make Permanent Configuration Changes. This is more complicated.
- ↑
1 Install a partitioning tool.
Note: No longer required for Build Version
17.3.9.2and above.Build version
17.3.9.2and below, please press Expand on the right.Install a tool such as
gpartedthat can grow the filesystem.Install package(s)
gpartedfollowing these instructions:1 Platform specific notice.
- Kicksecure: No special notice.
- Kicksecure-Qubes: In Template.
2 Update the package lists and upgrade the system.
sudo apt update && sudo apt full-upgrade
3 Install the
gpartedpackage(s).Using
aptcommand line--no-install-recommendsoption is in most cases optional.sudo apt install --no-install-recommends gparted
4 Platform specific notice.
- Kicksecure: No special notice.
- Kicksecure-Qubes: Shut down Template and restart App Qubes based on it as per Qubes Template Modification.
5 Done.
The procedure of installing package(s)
gpartedis complete.Start the partitioning tool.
Start a terminal.
lxsudo gparted
Claim the new space.
- Increase the size of the filesystem.
- The user probably does not wish to create a new partition. Instead, the existing partition should be expanded.
2 Fix the partition type code.
Note: No longer required for build version
17.4.0.4and above.Build version
17.4.0.4and below, please press Expand on the right.This is a fix for Failed to start systemd-repart.service - Repartition Root Disk

.
sudo sgdisk --typecode='3:4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709' /dev/sda
- ↑ Alternatively, advanced users can make Permanent Configuration Changes. This is more complicated.
We believe security software like Kicksecure needs to remain Open Source and independent. Would you help sustain and grow the project? Learn more about our 14 year success story and maybe DONATE!