Subject: Re: Resizing netbsd disk partition
To: Manuel Bouyer <bouyer@antioche.eu.org>
From: Anzi <anzi@dnainternet.net>
List: netbsd-users
Date: 01/18/2007 14:53:29
Manuel Bouyer wrote:

>On Tue, Jan 16, 2007 at 07:06:03PM +0200, Anzi wrote:
>  
>
>>Anzi wrote:
>>
>>    
>>
>>>Manuel Bouyer wrote:
>>>
>>>      
>>>
>>>>On Mon, Jan 15, 2007 at 03:03:58PM +0200, Anzi wrote:
>>>>
>>>>
>>>>        
>>>>
>>>>>Hello all
>>>>>
>>>>>I have a netbsd 3.1 machine running some xen stuff. Unfortunately I 
>>>>>made the original disk partitioning poorly and disk is running out. 
>>>>>The question is how can (if possible)  I resize the netbsd partion 
>>>>>(grow netbsd partition at the end of disk) without reinstalling 
>>>>>everything?
>>>>>
>>>>>Or is there a way to access partions outside the netbsd partition 
>>>>>(disklabel)?
>>>>> 
>>>>>          
>>>>>
>>>>Yes, in disklabel you can define partition outside the netbsd partition.
>>>>To make things more consistent you can also extent the NetBSD partition:
>>>>fdisk -u
>>>>then disklabel -e to extend the 'c' partition by the same amount.
>>>>
>>>>
>>>>
>>>>        
>>>>
>>>I run fdisk -u wd0 and changed partition to extend to end of disk. Now 
>>>I am wondering what is "same amount" that I should write to disklabel :)
>>>
>>>I'm really confused about disklabel, I haven't played with netbsd / 
>>>unixes that much, only Linuxes. So how can I calculate the correct 
>>>amount?
>>>
>>>tried something and got:
>>>
>>>"disklabel: partition c: partition extends past end of unit"
>>>
>>>
>>>      
>>>
>>I found some more info about bsd disklabel, so I assume that I can add a 
>>partition called 'e' with following lines to disklabel .
>>'e' would fill out the rest of the partition ( size and offset marked 
>>with stars)?
>>
>>|#        size   offset    fstype   [fsize bsize bps/cpg]
>> e:        *        *    4.2BSD     2048  16384   16   
>>
>>#
>>
>>
>>Is this correct? if it is this is pretty good to configure compared to 
>>windows partitions...
>>    
>>
>
>Yes, it's correct
>
>  
>
>>or maybe like this (don't know whether the offset should be there):
>>
>>|
>>
>>|#        size   offset    fstype   [fsize bsize bps/cpg]
>> e:        10G      *    4.2BSD     2048  16384   16   |
>>
>>|  f:        10G      *    4.2BSD     2048  16384   16   |
>>    
>>
>
>Exept you can't use '10G', you have to tell a number of sectors.
>For the offset it's easy: it's previous partition (it you case b, I guess) 's
>offset + previous partition's size.
>
>  
>
Thank you Manuel! I now understand much more about bsd disklabel and its 
partions! I was able to change my both machines disklabel and partions 
with no data lost!

I mainly used disklabel -e wd0 (interactive mode) because it understood 
megabytes also. But I also learned very much about sectors etc..