• Linux
  • FreeBSD
  • Networking
  • Python
  • AWS
  • WebDev
  • About Us

How to increase the disk size in FreeBSD

Written by
FreeBSD Leave a Comment

I have cloned my FreeBSD 16GB SSD to a 28GB SSD . So everything  works fine from the new SSD  but I am unable to use the extra storage I had added . Another popular scenario of resizing the partition is adding extra storage to your virtual machines or SAN devices .In either case , you need to resize your partition to make it usable . I am using zfs file system here.

First do a ‘df -h’ and you can see the available disk space which is only 4.5G

Now run a ‘gpart show’ and you can see I have a free 21G at the end .

You can see the numbering here and number 3 is my usable disk which formatted with freebsd-zfs .So you need to add the availabe free storage to this one . So the below command will resize the disk to 21G , if you want to add it to the top of existing 5G , you need to add it with the 21G, ie, 26G .I am doing only 21G in total here .

gpart resize -i 3 -a 4k -s 21G ada0

ada0p3 resized , If you are getting any partition corupt error , you can run the recover command

gpart recover ada0

That’s now resized but you need to add it to the pool to get it active :

zpool online -e zroot ada0p3

If its ufs you need to run the ‘growfs’ instead of zpool

growfs /dev/ada1p3

Now if you run the ‘df -h’ you can see the file system is expanded

© Copyright 2020.TechieNix. All Rights Reserved.