Shrinking a partition

Lorenzo Salvadore phascolarctos at protonmail.ch
Fri Oct 5 09:05:26 UTC 2018


> Hello,
>
> Is it possible to shink a partition under FreeBSD?
>
> I found only one reference that seems to say it is possible
> https://unix.stackexchange.com/questions/324308/resizing-root-partition
>
> but whenever I try, growfs complains that the new size is smaller than
> the original size/
>
> So, I am wondering if it is another case of "don't trust what you read
> on the web"?
>
> Thanks in advance,
>
> Olivier

Maybe it is possible: I do not know, I never tried. I admit I do not understand
the logic behind the answer of stackexchange (making smaller than what you
want, then bigger again... when and how the data would be moved?), but even
if I understood it, if I were you, I would try a different strategy.

The best thing when changing partitions is to backup all data and restore it on
the disk after having created the new partition scheme. Moreover, since you
are dealing with sizes of partitions, I guess you are not using ZFS.
With ZFS you do not have do worry about sizes of partitions any more: you
can create as much filesystems as you want and their sizes will shrink and grow
accordingly to their need (you can set maximal and minimal sizes if needed). And
it has many more other advantages, see https://www.freebsd.org/doc/handbook/zfs.html .
If you choose to move from UFS to ZFS, as far as I know you can do it only by
saving your data through backup and then restore it on your disk after having
set ZFS.

I hope my answer can be useful.

Lorenzo Salvadore.


More information about the freebsd-questions mailing list