# Cannot grow filesystem on Vagrant server



## thefonzz2625 (Jun 29, 2018)

Grew a vagrant box from 30 GB to 150 GB. Rearranged the swap partition so that gpart could do an online resize of the UFS partition. Can't seem to grow the filesystem now.

Error Message: growfs: UFSSUSPEND: Bad file descriptor

```
[vagrant@perl-reporter-03 ~]$ sudo growfs /dev/ada0s1a
Device is mounted read-write; resizing will result in temporary write suspension for /.
It's strongly recommended to make a backup before growing the file system.
OK to grow filesystem on /dev/ada0s1a, mounted on /, from 30GB to 147GB? [yes/no] yes
growfs: UFSSUSPEND: Bad file descriptor
[vagrant@perl-reporter-03 ~]$ gpart show
=>       63  314572737  ada0  MBR  (150G)
         63          1        - free -  (512B)
         64  314572736     1  freebsd  [active]  (150G)

=>        0  314572736  ada0s1  BSD  (150G)
          0  308281344       1  freebsd-ufs  (147G)
  308281344    3276800       2  freebsd-swap  (1.6G)
  311558144    3014592          - free -  (1.4G)
```

Any suggestions?


----------



## Crivens (Jun 29, 2018)

Do this in single user mode with the unmounted file system. If necessary, after reboot to single user on the read only file system.


----------



## thefonzz2625 (Jun 29, 2018)

I'm getting to this server via "vagrant ssh", if I go to single user mode I'll be locked out. Also, this is the root filesystem. 

This box is being booted via "vagrant up". Not sure if I can boot off another medium.


----------



## SirDice (Jun 29, 2018)

You might want to try sysutils/firstboot-growfs and add it to your Vagrant image. The 'trigger' to run this is the existence of a file called /firstboot (it doesn't have to contain anything, it just needs to exist).

There are a few other firstboot-* packages that are extremely useful for spawning new VMs from images.

Pro-tip: If you create your own images and expect them to grow, place the swap partition first on the disk and put the freebsd-ufs partition last. That will make it a lot easier to automate the expansion.


----------

