I am currently running a Vagrant box with archlinux for development purposes. I wanted to go beyond the 2GB so I installed the vagrant-disksize
plugin and after ssh'ing into the box and changing the partition size, I ran resize2fs as suggested here.
However, when I do that, I get the following error:
resize2fs: Device or resource busy while trying to open /dev/sdax
Couldn't find valid filesystem superblock.
Here's what the man page says about resize2fs
:
If the filesystem is mounted, it can be used to expand the size of the mounted filesystem, assuming the kernel and the file system supports on-line resizing.
How can I use resize2fs
with my archlinux box?
tldr: resize2fs doesn't work on btrfs
Resolution:
After investigating the issue, I found out that the archlinux Vagrant box was set up with
btrfs
insteadext4
. If you want to expand your disk size on Vagrant/VirtualBox and Arch Linux you will have to.Steps to follow
Increase the physical disk size by either 1. using the Vagrant
disk-resize
plugin, 2. manually dismounting and cloning the drive withVBoxManage
, or 3. activating the Vagrant experimental feature flag (oct. 2020).Resize the partition inside the OS with
{,c}fdisk
orparted
.Check the file system on your partition with
lsblk --fs
. If you happen to run on btrfs, you won't be able to useresize2fs
. You'll have to go throughbtrfs filesystem resize max / (the mount point)
A few links that could be of use:
https://www.suse.com/support/kb/doc/?id=000018798
https://gist.github.com/christopher-hopper/9755310
https://askubuntu.com/questions/317338/how-can-i-increase-disk-size-on-a-vagrant-vm