LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to restore Linux on different partition? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-restore-linux-on-different-partition-4175457337/)

Cougar! 04-08-2013 07:43 AM

How to restore Linux on different partition?
 
Hi All,

I'm a fresh user of linux. Recently my HDD got bad track and I replaced it with a new one. Originally my partition is:

/dev/sda2 mounted as /boot
/dev/sda5 mounted as /
/dev/sda6 mounted as /usr

Now I want to merge the three partitions i.e.

/dev/sda1 mounted as /

How to do that by editing /boot/grub/menu.lst and /etc/fstab? I use Grub 0.97 so I'm afraid the article "Fix boot failure after restore partition to a different partition with Clonezilla"(http://www.linuxquestions.org/questi...la-4175411303/) can't help me.

bryanl 04-08-2013 10:42 AM

some 'been there, done that' guru will likely show up soon, but till then, here's what I see as the challenge:

Set up the new drive and restore all files to the new partition. Your old root partition should have boot and usr mount points you can restore the boot and usr partitions to on the restore. In your new root, edit /etc/fstab to remove the /usr and /boot mounts. You will also need to replace the old drive partition UUID for the root partition with the new one.

Then you'll need to re-install GRUB - see http://tcl.leipper.org/2009/05/restoring-grub/ for a couple of links on how to do this. This is basically just running the GRUB install program with parameters that tell it the target install partition. Editing the grub menu just won't do it as the boot sector code has to be able to find the /boot partition that has the menu in it and other boot files. The way that code gets updated is via the GRUB install utility. (see 'info grub-install' )

good luck, have fun!

spiky0011 04-08-2013 10:58 AM

Hi Cougar!

What have you done so far

John VV 04-08-2013 11:49 AM

what operating system is this ?

if you are using grub legacy ( grub 0.97 )
the /boot will likely need to be formatted to ext2
with / and /usr ( not needed ) partitions as ext3

/ and /usr can be merged , but it is likely much easier for you to just reinstall and not make a /usr partition
then move over your data from the back up

goumba 04-08-2013 11:50 AM

As well as reinstalling grub, you'll have to make sure any UUIDs or label names have been updated in grub's configuration, as well as in /etc/fstab (as stated above). You did not mention what distribution you are using. If you're lucky enough to be using a Debian based distro (Debian, Ubuntu, Mint, for starters), just run dpkg-reconfigure grub-pc as root (inside the chroot environment as desribed above) to reinstall and set up the menu. If you're running on an EFI system, you'll need to run dpkg-reconfigure on the appropriate grub-efi package.

Cougar! 04-09-2013 05:06 AM

I edited /boot/grub/menu.lst , changing root=/dev/disk/by-id/ata-Hitachi_...-part5/6 to part1 and I edited /etc/fstab , and the OS booted successfully! Thanks everyone!


All times are GMT -5. The time now is 07:25 AM.