Adding a new hard drive, and using geom

Jerry McAllister jerrymc at msu.edu
Mon Jul 7 17:01:15 UTC 2008


On Sun, Jul 06, 2008 at 01:13:17AM -0500, Joshua Isom wrote:

> I bought a second hard drive for my computer since my /usr partition 
> was getting full.  I don't want to deal with hardware raid since I 
> don't want to be dependent on a certain hardware vendor or chipset, so 
> I'm wanting to go with geom.  I'd prefer to not have to backup all my 
> data(I know I should anyway, but it's a 500gb hard drive, and drives 
> are growing faster than backup solutions).  Would it be possible to do 
> a geom stripe to expand /usr and keep all the data or would I just need 
> to backup everything, and then put it all back?  If I must deal with 
> backing up and erasing, and considering that the current /usr and the 
> new drive aren't the same size, how would I go about mirroring other 
> paritions and striping /usr?  Would that still be easily bootable(no 
> special hacks or workarounds)?
> 
> Any tips or other recommendations would be appreciated. 

Well, it depends a little on how you have your first drive
broken up.   I don't put all that much in to /usr, but some people
put almost everything there including users' home directories.
I put home directories in /home, not /usr/home (and then make /home
one of those big(ger) storage spaces where things can grow, but not
everyone does that. 

Anyway, Since you don't really seem to be interested in raid or other 
such arrangements, (for this I think you make a good choice) my 
suggestion is that you just fdisk-bsdlabel-newfs it to one large slice 
and partition.  Presuming is is sata and it is only the second drive 
it would then be  /dev/ad1s1a  (or da1s1a if it is SCSI or SAS).

I would then make a mount point something like /work  (or whatever name 
makes sense for you)   and then mount there (and fix up /etc/fstab).
Then I would move chunks of /usr and other partitions that are getting
full in to it and make symlinks.    That gives you a lot of flexibility
and you don't have to worry about managing stripes and raid.  If 
something like /var/db or /usr/home grow wildly, you can easily 
add yet another drive or even a raid and move those there later.

Some things to move there, depending on how you are presently set up, 
might be:    /usr/local,  /usr/src, /usr/ports,  /usr/home  /var/log,
/var/spool,  /var/db/      It is easy to move them and make symlinks.

For example:

Build the slice using fdisk, the partition using bsdlabel and newfs it
taking the defaults.

  mount /dev/ad0s1a /work

  cd /usr/local
  tar cvpf /work/ulocal.tar *
  cd /work
  mkdir usr.local
  cd usr.local
  tar xvpf ../ulocal.tar
Take some time to look it over and make sure it is good.
  cd /usr
  mv local oldlocal
  ln -s /work/usr.local local
Make sure it works by cd-ing to /usr/local/... and making sure
you get where you want and all is well.
  rm -rf oldlocal
  cd /work
  rm ulocal.tar

I prefer this slightly longer procedure because it leaves stuff around
in case of error until I get a chance to check it out.   But, you
could just run the tar piped to a tar with an embedded cd  and it would 
also work just fine.

I also like to name the directories I move mnemonically such as 
the usr.local (or usr.src or var.log, etc) because it keeps things clear.

////jerry

> 
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"


More information about the freebsd-questions mailing list