Re: Resizing ext2 filesystems
You might want to try switching them. I've done this successfully, but it
can get kinda hairy if something screws up.
First you'll want to tar up everything in home (go ahead and compress it with
gzip or bzip2 as well), and move this file somewhere else. Unless your /home
directory is full of binaries or similar objects that don't compress well,
you could probably fit the resultant tar.gz or tar.bz2 file into your first
(root) partition. Now delete everything from /home. Next copy everything
from /usr into /home (be sure to maintain permissions and all that . . . you
might want to look at the cp manpage, I had to -- if I recall the -a switch
will do all that's needed, but it's been awhile). Now you want to type:
mv /usr /usr-old
mv /home /usr
mv /usr-old /home
Now you need to edit your /etc/fstab. Currently /dev/sda6 is mounted on
/usr, and /dev/sda7 is mounted on /home. Change the partitions to what they
should now be (/dev/sda7 on /usr and /dev/sda6 on /home).
Make a rescue disk :) --personally I swear by the Slackware bootdisks, even
though I run Debian. When it comes to bailing your system out of a big pile
o sh*t, the Slackware bootdisks give you far more tools than any of the
others. But anyway, I just like to have a way to mount the hard drive and
change files via a floppy, just in case there is a typo or something.
Go grab a beer, a glass of wine, or a shot of liquor, and reboot.
Upon boot, you want to login as root. First check to make sure everything
has shifted correctly (df will do). If everything looks correct (i.e. /usr
is listed as being mounted on the larger /dev/sda7 partition, and /home is
listed as being mounted on /dev/sda6). If everything looks correct, then
delete everything under /home, and decompress/untar your saved home.tar.bz2
(that one you made earlier) into the /home directory, and tada, you're set.
If you feel like being brazen, you really don't have to go through all the
file copying stuff, but I wanted to just in case something weird happened. I
figured that out of two copies of the /usr directory, at least one would be
recoverable. This is probably being over-cautious, but at the time I REALLY
didn't want to have to do a reinstall, etc.
Hope this works for you, it did for me.
Sean
Max wrote:
> I have a problem in that I'm quickly running out of space in /usr but
> I have tons of space left in /home. Here's what df shows:
>
> Filesystem 1k-blocks Used Available Use% Mounted on
> /dev/sda1 497667 35357 436608 7% /
> /dev/sda5 497667 385312 86653 82% /var
> /dev/sda6 2478138 2271514 78508 97% /usr
> /dev/sda7 4616953 643170 3734818 15% /home
>
> Obviously, I didn't estimate the filesystem sizes correctly to begin
> with. At this poit, does anyone know of a way to resize them so that
> some of the space from /dev/sda7 can be added to /dev/sda6? I have
> heard of "resize2fs" but it appears that it's not available other than
> as part of Partition Magic. Is there anything else out there?
>
> Thanks,
> Max
>
> --
> The hopeful depend on a world without end
> Whatever the hopeless may say
> Neil Peart, 1985
>
> ------------------------------------------------------------------------
> Part 1.2Type: application/pgp-signature
--
The man who sees, on New Year's day, Mount Fuji, a hawk, and an eggplant
is forever blessed.
-- Old Japanese proverb
Reply to: