Monday, June 13, 2022

Re: How to compact partitions (disklabel)?

On 2022-06-13, Mike Fischer <fischer+obsd@lavielle.com> wrote:
> After solving a recent problem on a VM where the /usr/local was full I was left with a disklabel that had a hole of unused space in it (see below for details). I was wondering if there is a way to compact the partitions, i.e. move the partitions following the deleted one up to fill the hole, potentially leaving corresponding free space at the end.
>
> I'd prefer to not have to use dd(1) on the raw device to move the data? I'd hope for something that is smart enough to adjust the disklabel after moving the bytes. Wishful thinking?

There's no good way to do this. My preference would be to attach a new
virtual disk, partition either manually or according to current auto
defaults for the larger disk, dump|restore and run installboot, then
remove the old virtual disk.

> 16 partitions:
> # size offset fstype [fsize bsize cpg]
> f: 5056800 8025952 4.2BSD 2048 16384 12960 # /usr

You might find this a little tight too after some updates.

--
Please keep replies on the mailing list.

No comments:

Post a Comment