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

Re: resize the partition with /

On 10/1/07, Raj Kiran Grandhi <grajkiran@gmail.com> wrote:
> > So I'd like to resize hda2 but I can't as it said I need to unmount
> > hda2 before resizing.  People suggest using a live CD but it's not
> > possible with my old laptop (I didn't even install etch using CD, I
> > can only install etch via goodbyemicrosoft.com).  USB boot is also not
> > available.
> >
> If a couple of reboots is ok for you, the following method might work.

Yes, and thanks a lot for the instruction.

> You can use 'dd' to clone hda2 to hda1. Boot your system with
> "init=/bin/bash". When you get to the bash prompt, do
> bash# dd if=/dev/hda2 of=/dev/hda1
> When that completes, you would have your installation available on both
> the partitions. The 5GB hda1 would contain a filesystem that is only 1GB
> large. Restart your system. You would boot normally with a 1GB root.
> Edit "/boot/grub/menu.lst" and add an entry for the linux on hda1.
> set root to (hd0,0) and append root=/dev/hda1 for the kernel line of the
> new entry.
> mkdir /tmp/newroot; mount /dev/hda1 /tmp/newroot
> Edit the file /tmp/newroot/boot/grub/menu.lst and replace (hd0,1) with
> (hda0,0) and root=/dev/hda2 with root=/dev/hda1. Similarly fix the root
> filesystem entry in /tmp/newroot/etc/fstab by changing /dev/hda2 to
> /dev/hda1.
> Now you should be able to boot into either of your two partitions.

So I got two grub/menu.lst, but how grub knows which one to read (one
is hda1 and one is hda2)?

> Once you have satisfied yourself that both are working, boot into your
> 1GB partition, and resize hda1. The command "resize2fs /dev/hda1" should
> be sufficient.
> Restart into the 5GB parition and now you would have a 5GB root with
> over 4GB free space.
> Run "grub-install /dev/hda" so that grub can load itself from the new
> location.
> You can now copy over your home directory from the 1GB partition and
> continue using hda1. If you wish you format hda2 and mount it as /home.
> Feel free to post any problems you may have and make sure you take a
> backup of important files before proceeding.

Finally I followed your instruction and now I got what I wanted.
Really thanks a lot and hopefully this can help others too.  (not to
mention I learned a lot!) :)


Reply to: