FreeBSD growfs: operation not permitted (aka: enlarge your partition)

May 18, 2015 4.5k views
System Tools Scaling FreeBSD

Hi there,

I recently upgrade my Droplet from 20 to 30 GiB space, yet I'm unable to resize my filesystem space in order to fill the new hard disk size. I have a FreeBSD 10.1 droplet.

I followed the instruction described by the official FreeBSD handbook: disk growing.

I executed the commands from single user mode.

The error occurs at the very final step:

growfs /dev/vtbd0p3
Operation not permitted

Anyone is aware of special actions to take care for DigitalOcean droplets?
Someone managed to increase the disk space?

Thank you very much.

Best Regards,

Nicholas

5 comments
  • Hey @lordgordon! Could you open a support ticket so the team can take a closer look at this issue? The filesystem should have been grown automatically as part of the resize process.

  • Sure! Thank you @asb.

  • Is there any updates om this, i have the same problem but cant find a solution

  • Yes, unfortunately UFS doesn't support the resize process. You need to create a snapshot of your droplet and create a new one with the new size using the snapshot. If you delete your current droplet and create a new one immediately you should have reassigned the very same IP.

    I suggest to check with the great DigitalOcean support for further details.

  • I too made an upgrade from 20GB to 30GB. I too was also attempting growfs /dev/vtbd0p3 with the same result.

    Found myself exploring /etc/rc.d/growfs. Discovered it worked when called as a service.

    FreeBSD 10.2> df
    Filesystem      1K-blocks    Used    Avail Capacity  Mounted on
    /dev/gpt/rootfs  20307196 5350028 13332596    29%    /
    devfs                   1       1        0   100%    /dev
    
    FreeBSD 10.2> service growfs onestart
    Growing root partition to fill device
    vtbd0 recovered
    vtbd0p3 resized
    super-block backups (for fsck_ffs -b #) at: ###, ###, ...
    
    FreeBSD 10.2> df
    Filesystem      1K-blocks    Used    Avail Capacity  Mounted on
    /dev/gpt/rootfs  29442440 5350028 21737020    20%    /
    devfs                   1       1        0   100%    /dev
    

    Examined $rootdev in /etc/rc.d/growfs and found to have the value of gpt/rootfs

    So for the 'hip' crowd, we do

    FreeBSD 10.2> sysctl kern.geom.debugflags=16
    kern.geom.debugflags: 0 -> 16
    FreeBSD 10.2> gpart show
    =>       3  44040224  vtbd0  GPT  (30G) [CORRUPT]
             3        32      1  freebsd-boot  (16K)
            35   2097152      2  freebsd-swap  (1.0G)
       2097187  41943040      3  freebsd-ufs  (20G)
    FreeBSD 10.2> gpart recover /dev/vtbd0
    vtbd0 recovered
    FreeBSD 10.2> gpart show
    =>       3  62914555  vtbd0  GPT  (30G) **no longer corrupt**
             3        32      1  freebsd-boot  (16K)
            35   2097152      2  freebsd-swap  (1.0G)
       2097187  41943040      3  freebsd-ufs  (20G)
      44040227  18874331         - free -  (9.0G)
    FreeBSD 10.2> gpart resize -i 3 vtbd0
    vtbd0p3 resized
    FreeBSD 10.2> gpart show
    =>       3  62914555  vtbd0  GPT  (30G)
             3        32      1  freebsd-boot  (16K)
            35   2097152      2  freebsd-swap  (1.0G)
       2097187  60817371      3  freebsd-ufs  (29G)
    FreeBSD 10.2> df
    Filesystem      1K-blocks    Used    Avail Capacity  Mounted on
    /dev/gpt/rootfs  20307196 5350052 13332572    29%    /
    devfs                   1       1        0   100%    /dev
    FreeBSD 10.2> growfs -y /dev/gpt/rootfs
    super-block backups (for fsck_ffs -b #) at: ###, ###, ...
    FreeBSD 10.2> df
    Filesystem      1K-blocks    Used    Avail Capacity  Mounted on
    /dev/gpt/rootfs  29442440 5350052 21736996    20%    /
    devfs                   1       1        0   100%    /dev
    

    All the while mounted.

    I'm not sure if sysctl kern.geom.debugflags=16 is really needed now as the /etc/rc.d/growfs script makes no attempt to call it, and it is successful.

2 Answers

You need to be in single user mode (init 0). You have to do it from the control panel console, You can't do it from an ssh session. (Which makes sense, since single-user mode disables outside access.)

A useful page is in the FreeBSD Handbook: https://www.freebsd.org/doc/handbook/disks-growing.html (note especially if your current partition is not the last one)

The steps I took: (my disk was vtbd0, partition to grow was #3)

  1. snapshot
  2. droplet resize
  3. restore snapshot
  4. gpart show, gpart recover
  5. gpart resize -i [partition] -a 4k -s [full size] [disk id, in my case vtbd0]
  6. single user mode (init 1)
  7. growfs /dev/vtbd0p3
  8. reboot to multiuser mode (init 6, or just a normal reboot)

Hope that helps someone!

But I really do growfs /dev/vtbd0p3 at SSH , and it really work. I've tried reboot again after "growfs" and it still show new size of droplet (I change from 20GB to 40GB)

Thanks for the comment of "veeblefetzer" I just use

ns1:/usr/local/www>df -h

Filesystem         Size    Used   Avail Capacity  Mounted on
/dev/gpt/rootfs     19G    9.6G    8.3G    54%    /
devfs              1.0K    1.0K      0B   100%    /dev
fdescfs            1.0K    1.0K      0B   100%    /dev/fd

ns1:/usr/local/www>growfs /dev/gpt/rootfs
growfs: requested size 20GB is not larger than the current filesystem size 20GB

ns1:/usr/local/www>growfs /dev/vtbd0p3
growfs: requested size 20GB is not larger than the current filesystem size 20GB

ns1:/usr/local/www>service growfs onestart

Growing root partition to fill device
vtbd0 recovered
vtbd0p3 resized
super-block backups (for fsck_ffs -b #) at:
 42314112, 43596352, 44878592, 46160832, 47443072, 48725312, 50007552, 51289792, 52572032, 53854272,
 55136512, 56418752, 57700992, 58983232, 60265472, 61547712, 62829952, 64112192, 65394432, 66676672,
 67958912, 69241152, 70523392, 71805632, 73087872, 74370112, 75652352, 76934592, 78216832, 79499072,
 80781312

ns1:/usr/local/www>df -h

Filesystem         Size    Used   Avail Capacity  Mounted on
/dev/gpt/rootfs     38G    9.6G     25G    28%    /
devfs              1.0K    1.0K      0B   100%    /dev
fdescfs            1.0K    1.0K      0B   100%    /dev/fd

ns1:/usr/local/www>gpart show

=>       3  83886075  vtbd0  GPT  (40G)
         3        32      1  freebsd-boot  (16K)
        35   2097152      2  freebsd-swap  (1.0G)
   2097187  81788891      3  freebsd-ufs  (39G)

ns1:/usr/local/ww>gpart status

 Name  Status  Components
vtbd0p1      OK  vtbd0
vtbd0p2      OK  vtbd0
vtbd0p3      OK  vtbd0

and it really easy wonderful work.....easy until you unbelievable (I use FreeBSD 10.2)

Have another answer? Share your knowledge.