LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 03-08-2008, 03:28 PM   #1
Frank64
Member
 
Registered: Feb 2008
Distribution: Kubuntu 11.10 64-bits
Posts: 70

Rep: Reputation: 15
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

Last edited by Frank64; 03-08-2008 at 05:12 PM.
 
Old 03-08-2008, 03:45 PM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Squeeze
Posts: 5,784

Rep: Reputation: 311Reputation: 311Reputation: 311Reputation: 311
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.

Last edited by bigrigdriver; 03-08-2008 at 03:49 PM.
 
Old 03-08-2008, 03:50 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,355

Rep: Reputation: 1042Reputation: 1042Reputation: 1042Reputation: 1042Reputation: 1042Reputation: 1042Reputation: 1042Reputation: 1042
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.
 
Old 03-08-2008, 04:50 PM   #4
Frank64
Member
 
Registered: Feb 2008
Distribution: Kubuntu 11.10 64-bits
Posts: 70

Original Poster
Rep: Reputation: 15
No it's not UUID, it's DEVICE ID. Sorry for misleading. I will immediately edit my post.

Last edited by Frank64; 03-08-2008 at 05:13 PM.
 
Old 03-08-2008, 05:06 PM   #5
Frank64
Member
 
Registered: Feb 2008
Distribution: Kubuntu 11.10 64-bits
Posts: 70

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by bigrigdriver View Post
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!

Last edited by Frank64; 03-08-2008 at 05:13 PM.
 
Old 03-09-2008, 02:17 PM   #6
Frank64
Member
 
Registered: Feb 2008
Distribution: Kubuntu 11.10 64-bits
Posts: 70

Original Poster
Rep: Reputation: 15
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!
 
  


Reply

Tags
backup, boot, clone, dd, id, partition, uuid, volume


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
NTFS USB flash pen - UUID problem again starter_07 Debian 5 08-14-2007 04:01 PM
Two partitions are sharing one UUID. hpladd Linux - Hardware 1 07-28-2007 04:17 PM
UUID: wrong values in Ubuntu /etc/fstab files grautu Ubuntu 7 05-05-2007 04:28 PM
Uuid hansi umayangan Linux - General 2 03-14-2005 04:57 AM
Problem installing jfsutils-1.1.7, cannot find uuid library kit_johnson Linux - Software 1 11-30-2004 08:07 AM


All times are GMT -5. The time now is 05:23 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration