Re: How to compact partitions (disklabel)?

2022-06-13 Thread Mike Fischer


> Am 13.06.2022 um 10:21 schrieb Stuart Henderson :
> 
> On 2022-06-13, Mike Fischer  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.

Ok, thanks! I thought I missed something ;-)


> 
>> 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.

# df -h
Filesystem SizeUsed   Avail Capacity  Mounted on
/dev/sd0a  615M108M476M18%/
/dev/sd0k  3.7G798M2.7G22%/home
/dev/sd0d  863M8.0K820M 0%/tmp
/dev/sd0f  2.3G1.7G555M76%/usr
/dev/sd0g  648M299M317M48%/usr/X11R6
/dev/sd0l  4.8G2.2G2.4G48%/usr/local
/dev/sd0j  5.2G2.0K4.9G 0%/usr/obj
/dev/sd0i  1.4G968M402M71%/usr/src
/dev/sd0e  1.3G425M806M35%/var
# 

24% (555M) free seems ok for now, but thanks for the heads-up.


Mike



Re: How to compact partitions (disklabel)?

2022-06-13 Thread Stuart Henderson
On 2022-06-13, Mike Fischer  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.