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

Re: resize the partition with /



Manu Hack wrote:

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)?

Grub will read the menu.lst from the partition that contained /boot/grub/menu.lst when "grub-install" was run.

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!) :)

This is one important reason why I am in love with linux. :) A little curiosity and it lets you learn everything you care about hardware/software.



Reply to: