On Sun, Dec 09, 2007 at 04:21:05PM -0800, Todd Walton wrote:
I partitioned my hard drive at something less than optimal.  Now I'd
like to put /usr on a different partition.  How do I do this?

I suppose I have to 1) copy the contents of /usr over to the new
filesystem on the new partition, and 2) tell my filesystem to use
that.

So... maybe...

# mount /dev/sda3 /mnt/newusr
# cp /usr /mnt/newusr
# umount /dev/sda3
# mount /dev/sda3 /usr

You probably don't want to do this while the system is running, although
/usr is supposed to be safe from changes, it probably isn't.  Also, when
you mount the new /usr on top of the old one, it won't free up any of the
space used by the new 'usr' data.

You'll want to make sure that whatever does your copy fully preserves the
permissions of the copied data.  'cp -a' should do this, you can also use
tar, or rsync:

  # tar -cf - -C /usr . | tar -xpf - -C /mnt/newusr

or

  # rsync -aH --delete-after /usr/ /mnt/newusr

the '/' after /usr is very important, or you'll end up with a directory
called /mnt/newusr/usr with your data in it.

I recommend doing this from a rescue disk, my personal favorite being RIP
linux <http://www.tux.org/pub/people/kent-robotti/looplinux/rip/>, although
something like knoppix will work as well.

So, the process will be something like (after the rescue system boots):

  # mkdir /mnt/old /mnt/new /mnt/root
  # mount /dev/sda2 /mnt/old
  # mount /dev/sda3 /mnt/new
  # rsync -aH --delete-after /mnt/old/usr/ /mnt/new
     (wait here)
  # mv /mnt/old/usr /mnt/old/oldusr
  # umount /mnt/old
  # umount /mnt/new
  # mount  /dev/sda1 /mnt/root
  # vi /mnt/root/etc/fstab
     Add a /usr mountpoint to /dev/sda3 so it gets mounted on boot.

Once you find that it all works, you can delete the /oldusr directory.

Dave


--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list

Reply via email to