[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: resizing root partition



Matthew Weier O'Phinney wrote:

> When I originally created my disk partitions, I figured 3GB would be
> plenty for my root partition, and gave the rest of my 30GB disk over to
> my /home partition. However, my root now shows 90% usage, and I'd like
> to expand it -- or move my /usr area off onto another partition. Is this
> possible, and if so, can somebody point me to a howto?

Resizing may be possible, but I think you need to have the filesystem
unmounted to do that. So you'd have to boot up from another root fs,
such as a rescue floppy or a Knoppix CD. Also, if your root fs is not
followed by sectors that are not part of any partition, then I don't
think you can do it. Something like LVM might be able to fake it.

Moving /usr is probably less trouble. Here is how I would do it:

1. Reboot in single-user mode. This may not be essential, but it will
   save potential trouble when you get to step 6.

2. Create new partition for /usr; how big to make it depends on your needs.
   Use "du -sk /usr" to see how big your /usr directory is now; make the
   new partition bigger than that, since you don't want to have to go
   through all this again by running out of room. I would guess that 2 or
   3 GB should be sufficient, depending how many packages you have
   installed.

3. Mount new partition. ~/new-usr or any other mount point will do.

4. Use "cp -a /usr/* ~/new-usr/" to copy everything from /usr to the
   new partition, retaining symlinks, privileges, ownerships, etc.
   If you're really paranoid, use md5sum to verify that the copied
   files all match their originals.

5. Modify /etc/fstab to mount the new partition as /usr.

6. mv /usr /old-usr; mkdir /usr; mount /usr

7. If all appears well, "telinit 2" to switch back to multi-user mode.

8. Once you are sure that all is well, you can delete /old-usr.

Before actually following these instructions, wait a few hours to see if
anyone posts a follow-up saying that I've forgotten something or that
I'm just plain wrong. I've actually done this in the past, but not with
/usr (I did move /usr/local, but that's much less critical).

Craig

Attachment: pgpSKRaHGIdU7.pgp
Description: PGP signature


Reply to: