Skip to content

Instantly share code, notes, and snippets.

@Siecje
Last active August 10, 2022 19:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Siecje/42233192cabd6703fb208000b7e11a8e to your computer and use it in GitHub Desktop.
Save Siecje/42233192cabd6703fb208000b7e11a8e to your computer and use it in GitHub Desktop.
Expand Drive size with Tinycore Linux
# Create drive to VM
qemu-img create -f qcow2 test.qcow2 3G
# Download Live-CD
wget http://tinycorelinux.net/6.x/x86/release/Core-6.4.1.iso
# Start the VM with Live-CD and drive
qemu-system-x86_64 -cdrom Core-6.4.1.iso -m 512 -hda test.qcow2 --boot d
# If you don't have qemu-system-x86_64 use qemu-system
# Frugal Install
tce-load -wi tc-install
sudo tc-install.sh
c -> f -> 1 -> 2 (sda) - > y -> 3 (ext4) -> enter -> y -> enter
# Shutdown to restart without the disc
exitcheck.sh
# Run without Live-CD
qemu-system-x86_64 -m 512 -hda test.qcow2
# Currently system has 3 GB available
df
# shutdown to expand drive (.qcow2 file)
exitcheck.sh
# Increase drive size
qemu-img resize test.qcow2 +5G
# If you start is now `df` output will look the same
# Run with Live-CD to umount and expand available drive
qemu-system-x86_64 -cdrom Core-6.4.1.iso -m 512 -hda test.qcow2 --boot d
# Enter the following boot codes
mc base norestore
# Expand the partition
sudo fdisk /dev/sda
p -> d -> n -> p -> 1 -> enter -> enter -> a -> 1 -> w
# p shows partition table
# d deletes a partition (it automatically deletes the only one)
# n creates a new partition (then p for primary)
# Then enter twice for the start to the end
# a to set the bootable flag
# 1 to specify the first partition should be bootable
# w to save and exit
# Expand the file system
tce-load -wi e2fsprogs.tcz
sudo e2fsck -f /dev/sda1
sudo resize2fs /dev/sda1
# shutdown
exitcheck.sh
# Run without Live-CD
qemu-system-x86_64 -m 512 -hda test.qcow2
# Currently system has 8 GB available
df
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment