resizing partitions in the same slice

Jerry McAllister jerrymc at clunix.cl.msu.edu
Fri Mar 12 15:26:42 PST 2004


> 
> On Fri, Mar 12, 2004 at 02:22:21PM -0500, Jerry McAllister wrote:
> : Eugene Lee asked:
> : > 
> : > 	/dev/da0s1g   2064302 1464672  434486    77%    /usr
> : > 	/dev/da0s1h  10660096     720 9806570     0%    /data
> : > 
> : > I almost run out of space during a buildworld, so I'd like to expand
> : > /usr from 2 GB to 4 GB by taking space away from /data.
> [...]
> : > So my procedure to do this is to recalculate the size/offset/cylinder
> : > settings for my partitions "g" & "h", change those settings via
> : > disklabel(8), then use growfs(8) on /dev/da0s1g?  Seems simple enough,
> : > and the data on /usr should be preserved, correct?
> : 
> : Yes and no.   I do not think you can shrink a partition with these.
> : Since, in order to grow /dev/da0s1g you will have to shrink /dev/da0s1h
> : I think you cannot do what you want.   I may well be wrong on this.
> : I haven't tried it.
> 
> I'm a little surprised.  I would think that resizing partitions is a
> common request, that the idea of growing one partition while shrinking
> another is not a new or rare notion.  Can anyone else share their views
> or experiences?  The list archives contain few comments on the subject.

I can't answer to that very much.  I have always managed disk size by 
moving things around and making symlinks as I described.   Some people 
don't even have separate /usr and /var partitions.  They just include 
them in one large partition (often /usr actually or sometimes /home)
along with everything else and then they don't have to worry about
how to size things other than just getting enough disk overall.
What I suggested is sort of in between - by moving those directories
in /usr that tend to grow a lot in to the big grab-all partition.

> BTW, some places have recommended commercial solution like Norton Ghost
> or Partition Magic.  Do these products work on FreeBSD's UFS format and
> grok partitions-in-a-slice?

Partition Magic only manipulates slices and does not know anything
about partitions within slices - especially FreeBSD partitions.
I would guess that Norton is the same because it is made for Microsloth
environments.   UFS wouldn't have anything to do with it - that comes
later with newfs.

> [...symlinking /usr/{ports,local,src} to elsewhere...]
> : 
> : This should give you back quite a lot of your /usr file system
> : Although ports, local and src are the usual hogs, you may need
> : to use du in the /usr directory to find out what else is taking
> : lots of space if these aren't the ones.   Do you have a bunch of
> : home directories there or are you making them in /data for example.
> 
> I have /usr/home, and other stuff in /data.  I guess I could always
> symlink /usr/src to /data/src when doing a buildworld.  Drats.
> 
> : > But will /dev/da0s1h be okay?  Is editing the disklabel enough?  Or do I
> : > need to reformat the partition --- and, if so, how?  I'm not too comfy
> : > using newfs(8) directly.  Can I just run "newfs /dev/da0s1h" after
> : > running the growfs(8) command and it will use the disklabel settings?
> : > Or can I be a wuss and use /stand/sysinstall?  :-)
> : 
> : Editing the disklabel will change the partition sizes.  
> : Definitely /dev/da0s1h will be messed up.   Running newfs on it
> : will build a new filesystem in whatever is now that partition.
> 
> Got it.  I figured as much, but it's always good to get other opinions.
> Jerry, thanks for the feedback!
> 

Have fun,
////jerry


More information about the freebsd-questions mailing list