LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How to clone HD when using UUID in fstab? (https://www.linuxquestions.org/questions/linux-general-1/how-to-clone-hd-when-using-uuid-in-fstab-626655/)

Frank64 03-08-2008 03:28 PM

How to clone HD when using Device ID in fstab?
 
Hey, I have 2 HDD, exactly the same, Seagate 500Gb 7200.11. I want to use my 2nd as a full backup/clone of the primary one.

After spending 8-10hours playing around with DD commands, CP, FDISK, fstab, mounting, umounting, etc., I figured out why my 2nd hd was never booting.

When I installed linux (openSUSE64) I chose the worst option for recognizing the partitions and mounting file systems: Device ID.

This means in my fstab I have something like this:

Code:

/dev/disk/by-id/scsi-SATA_ST3500320AS_5QM04K05-part1 /                    etc...
/dev/disk/by-id/scsi-SATA_ST3500320AS_5QM04K05-part6 /home etc...

See the 5QM04K05, that's my disk ID. So after dding with if=dev/sda1 of=/dev/sdb1 I edited, from a live CD, all the disk IDs in my fstab to match my 2nd HDD's ID.

Well, upon startup, after grub when the OS loads all the devices and drivers, it still looks around for 5QM04K05 and it does not find it (which is ok cuz I have disconnected the drive to troubleshoot the issue of not booting from my 2nd HDD).

So now I am stuck, cuz if i clone my HD and it breaks sometime, yes my 2nd HD will be usable as a backup and my root image (I use g4l to backup my first partition) could be restored on the HD, but since the Device IDs will differ I will never be able to boot up no matter the other HD I would be using.

What are my options?
Where else can I change my Volume IDs on my 2nd HD besides fstab?
Should I use the OS's partitioner to change the fstab options for device path, say, instead of device ID?

Any ideas?

tnx

bigrigdriver 03-08-2008 03:45 PM

Is the second hard drive also listed in fstab, with UUIDs? If so, when you make the clone, edit the /boot/grub/menu.lst in the clone to point to the kernel and initrd on the second drive for a bootable OS. If the UUIDs are used in menu.lst, copy the UUIDs for the second drive from /etc/fstab and paste them into menu.lst.

Grub probably has information pointing to the first drive in the MBR, so, in the event of failure of the first drive, it would be necessary to boot a liveCD, mount the second drive, chroot into it, and run grub setup so the MBR points to the second drive.

syg00 03-08-2008 03:50 PM

That's not a UUID - if you did use UUID, the UUIDs would be the same. So much for Universally Unique ...
Personally I stay away from labels and UUID (and the like) - I simply still use the device designation for everything.

Only other place you should have to look is the boot-loader - but if you are getting to fstab, you're already through that.

Frank64 03-08-2008 04:50 PM

No it's not UUID, it's DEVICE ID. Sorry for misleading. I will immediately edit my post.

Frank64 03-08-2008 05:06 PM

Quote:

Originally Posted by bigrigdriver (Post 3082393)
Is the second hard drive also listed in fstab, with UUIDs? If so, when you make the clone, edit the /boot/grub/menu.lst in the clone to point to the kernel and initrd on the second drive for a bootable OS. If the UUIDs are used in menu.lst, copy the UUIDs for the second drive from /etc/fstab and paste them into menu.lst.

Grub probably has information pointing to the first drive in the MBR, so, in the event of failure of the first drive, it would be necessary to boot a liveCD, mount the second drive, chroot into it, and run grub setup so the MBR points to the second drive.

Yes it is in fstab with device IDs (not UUIDs, I did the correction in my original post). It is listed with its own ID, which has only 4 chars different than my primary disk.

You're right, I think that's the other place where I should change it, see:

Code:

###Don't change this comment - YaST2 identifier: Original name: linux###
title openSUSE 10.3
    root (hd0,0)
    kernel /boot/vmlinuz-2.6.22.5-31-default root=/dev/disk/by-id/scsi-SATA_ST3500320AS_5QM04K05-part1 vga=0x317 resume=/dev/sda5 splash=silent showopts
    initrd /boot/initrd-2.6.22.5-31-default


###Don't change this comment - YaST2 identifier: Original name: failsafe###
title Failsafe -- openSUSE 10.3
    root (hd0,0)
    kernel /boot/vmlinuz-2.6.22.5-31-default root=/dev/disk/by-id/scsi-SATA_ST3500320AS_5QM04K05-part1 vga=normal showopts ide=nodma apm=off acpi=off noresume edd=off 3
    initrd /boot/initrd-2.6.22.5-31-default

That's what I got now with primary disk and 2nd disk cuz I dded the whole partition from sda to sdb! So I need to edit that as well, on sdb. I have to change "5QM04K05" for "5QM07xxx", which I don't remember by heart.

Ok I will give this a try, I think it will do the job. :)

If I want to get rid of the Device ID setup and use Device Path (/dev/sda1 instead of the long string /dev/disk/by-id/scsi...), can I just to click the options in the fstab options of my OS' partitioner (or do it myself in fstab AND menu.lst)? Do you know if by changing it in the partitioner it will also edit menu.lst of grub?

Do I have to do anything else but edit fstab and menu.lst if I swap from VolID to device path? Like running tune2fs -U clear /dev/<partition>, but that's to clear the UUID for affected partition, and I am using Device ID, but maybe I have to run something?

I will give a try editing menu.lst with correct device ID first.
tnx!

Frank64 03-09-2008 02:17 PM

Solved! :)

Using device patch in both fstab and menu.lst solved the problem.

Since I am using eSATA as my 2nd disk, it seems my BIOS still defaults to internal SATA if it's connected. To make my 2nd HD to boot pasted grub I needed to unplug the internal SATA connector, even if i was choosing my eSATA HD as the primary device. But once connected alone, it booted no problem.

So now I can clone my primary and keep files up dated with rsync and if I encounter a problem, I have my g4l image file (using dd) of root and my eSATA drive which can boot. :)

tnx!


All times are GMT -5. The time now is 01:32 AM.