Introduction
If you installed openSUSE Leap 42.3 on a virtual machine, like I did, using the openSUSE installer on your Windows 10 system and went with all the defaults, you probably ran into the issue where the 8GB of default storage is already running short after your first boot and updates have run their course. I then had to figure out how to expand the root filesystem a little to make room for all the stuff I still had yet to install.
The following procedure highlights a specific way to accomplish the expansion using the tools provided with the current install and installation media. No other tools or software will need to be downloaded/installed.
Host OS: Windows 10, ver. 1709
Virtual Machine: Oracle VM VirtualBox, Version 5.2.8 r121009 (Qt5.6.2)
Virtual Image OS: openSUSE Leap 42.3
[size=4]Resize The Virtual Hard Disk
[size=2]
Before beginning, ensure the virtual machine running Leap 42.3 has been shutdown.
Verify this in the Oracle VM VirtualBox Manager, Machine Tools view, left-hand side.
Should say “Powered Off”[/size][/size]https://imgur.com/a/C9WT9
-
Click on the “Global Tools” drop-down menu and select “Virtual Media Manager”
https://i.imgur.com/jO4WE5v.png -
On the “Properties” view>“Hard disks” tab, select the virtual disk for Leap 42.3.
-
On the “Attributes” tab, use the “Size” slider or text box to increase the size of the virtual disk (I went with 20GB for my purposes)
https://i.imgur.com/AQgQY4e.png -
Click “Apply”
That’s it for resizing the virtual hard disk.
Resize The Root Partition size=2
[/size]
Now we need to resize the root partition on the virtual machine by booting into a rescue system. You will need to boot into the installation media in the VM.
-
Start the “openSUSE Leap 42.3 x86_64” virtual machine with the installation DVD image.
(If you’re boot order is default, the DVD usually boots first. If not, hit F12 when prompted and select the install DVD.) -
Once the virtual machine has booted into the install media menu, use the down arrow key on the keyboard to highlight the “More …” selection and hit Enter.
-
Ensure “Rescue System” is highlighted and press Enter.
It will take a few minutes to boot up. Be sure to answer any prompts and login as root (there is no password prompt). -
Once logged in, display your disk partitions using GNU Partition Editor and note the disk number of the root partition (should be the only one with a “boot” flag).
Note: Size values shown should not be taken literally, your system may be different.
tty1:rescue:~ # parted -l
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sda: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 1044MB 1043MB primary linux-swap(v1) type=82
2 1044MB 7.9GB 6.8GB primary btrfs boot, type=83
- Resize the partition, again, using GNU Partition Editor.
The following command will bring you into an interactive instance of the partition editor.
“resize” is the command you enter, then just follow the prompts as captured below.
(Note: The “End?” value you enter below should match the “Disk /dev/sda:” value shown above.)
Important: Do not forget the units for your new size.
tty1:rescue:~ # parted /dev/sda
GNU Parted 3.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) resize
Partition number? 2
End? [7.9GB]? 21.5GB
(parted) quit
Information: You may need to update /etc/fstab.
Now that the partition is resized you can verify using
parted -l
Next we need to resize the filesystem to match the new partition size.
Resize btrfs File System[size=2] (1)
In order to make use of all the room we just added, we’ll need to expand the btrfs filesystem.
[/size]1) Mount the newly expanded partition.
tty1:rescue:~ # mount /dev/sda2 /mnt
- Resize the file system.
tty1:rescue:~ # btrfs filesystem resize max /mnt
Resize '/mnt' of 'max'
That’s it! The root partition is now resized and ready for action. You can verify the filesystem size using
df -h
Reboot and Enjoy The Space
Reboot your Virtual Machine back to your virtual system hard drive and you should be running with all the new space you just set.
Reference
- How to resize/extend a btrfs formatted root partition - https://www.suse.com/support/kb/doc/?id=7018329