LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 04-17-2006, 03:30 AM   #1
jasontn
Member
 
Registered: Feb 2004
Location: Malaysia
Distribution: Fedora Core 2
Posts: 60

Rep: Reputation: 15
cat cloned hdd on different hdd models


I have a server that was set up by my previous sysadmin. He used a weekly cron script to mirror hda to hdc using:

cat /dev/hda > /dev/hdc

This is not a problem if both disks are identical. However, when i mirror to a disk with different parameters, it should be using the wrong partition table details, right?

I can now use the cloned disk without problems except for the OS complaining about that the last partition (hda9) of not being the correct size, etc. and refused to mount it.

I tried using fdisk to delete that last partition and recreate but i believe it recreates with wrong specs. How do i recreate this contentious partition?

Is the current partition table (hda1 to hda8) incorrect although it's working? If it's wrong, how do i correct it without losing any file?

Any help would be appreciated.
 
Old 04-20-2006, 04:34 AM   #2
Emmanuel_uk
Senior Member
 
Registered: Nov 2004
Distribution: Mandriva mostly, vector 5.1, tried many.Suse gone from HD because bad Novell/Zinblows agreement
Posts: 1,606

Rep: Reputation: 53
hum do not know if this is a good use of cat.
You may want to read learn the dd command (a LQ thread)

see command resize (it is in the above quoted thread)
 
Old 04-20-2006, 07:32 PM   #3
Electro
LQ Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
It is better to use cp instead of dd or cat when using hard drives with different geometry. Another way is using the filesystem's dump utility.

To fix the partition table use sfdisk. After you are done, use the resize option while mounting the partition. Though the resize option is for EXT2/3 and ReiserFS, but you have to use the resize utility for XFS and JFS partitions.
 
Old 04-20-2006, 07:47 PM   #4
ataraxia
Member
 
Registered: Apr 2006
Location: Pittsburgh
Distribution: Debian Sid AMD64
Posts: 296

Rep: Reputation: 30
Try using parted to fix the broken partition. It should hopefully be able to resize it properly without deleting data.

I also agree with the other posters, that this isn't a good way to do backups.
 
Old 04-21-2006, 01:47 AM   #5
jasontn
Member
 
Registered: Feb 2004
Location: Malaysia
Distribution: Fedora Core 2
Posts: 60

Original Poster
Rep: Reputation: 15
The kitten (HDD) i inherited was a result of a cat. :-)

I'll try the suggestions and post my outcome later. Thanks.
 
Old 04-21-2006, 09:19 AM   #6
db391
Member
 
Registered: Jun 2004
Location: Britain
Distribution: Slackware
Posts: 186

Rep: Reputation: 31
Quote:
Originally Posted by Emmanuel_uk
hum do not know if this is a good use of cat.
I find the cat method is a very bad way to back up data. (this is my personal view).

Why?
Suppose the source media has bad blocks/sector corruption: cat, cp and dd (yep, all three of them) will abort the transfer when it encounters the bad block. If the sysadmin really wanted to make a straight clone of the drive and attempt to avoid these kinds of complications, then dd_rescue is one alternative. (Not all distros have this command though.)

The other problem with the cat method is it assumes the target drive is the same size *or bigger*. The geometry won't matter as long as the drive is operating in LBA mode (which all drives over 8GB should), and as long as the bootloader works on the target drive. In fact, partitioning utilities (such as fdisk) tend to be the only programs that fuss about CHS geometry anyway.
 
Old 04-23-2006, 10:22 PM   #7
jasontn
Member
 
Registered: Feb 2004
Location: Malaysia
Distribution: Fedora Core 2
Posts: 60

Original Poster
Rep: Reputation: 15
I'm trying to clone a different HDD using cp. I've copied all the partitions to the second HDD (which already had some partitions), one by one. Which directory should I omit, e.g. /dev, /proc?

How do I copy the MBR?
 
Old 04-24-2006, 01:16 AM   #8
Emmanuel_uk
Senior Member
 
Registered: Nov 2004
Distribution: Mandriva mostly, vector 5.1, tried many.Suse gone from HD because bad Novell/Zinblows agreement
Posts: 1,606

Rep: Reputation: 53
backup MBR see learn dd command thread

If you start omitting, then you are not really cloning, it is a backup.

It depends what you want to achieve
 
Old 04-24-2006, 01:36 AM   #9
jasontn
Member
 
Registered: Feb 2004
Location: Malaysia
Distribution: Fedora Core 2
Posts: 60

Original Poster
Rep: Reputation: 15
I noticed that some of the mount points are not mounted partitions, e.g. dev, proc, etc. I thought these are "files" created in UNIX for tracking real resources that would be generated at runtime. Please correct me if i'm wrong.

Thus i wonder whether they need to be backed up at all.
 
Old 04-24-2006, 02:58 AM   #10
jasontn
Member
 
Registered: Feb 2004
Location: Malaysia
Distribution: Fedora Core 2
Posts: 60

Original Poster
Rep: Reputation: 15
Copied MBR for HDD with partitions copied with cp:

dd if=/dev/hda of=/home/sam/MBR.image bs=446 count=1

dd if=/home/sam/MBR.image of=/dev/hdc bs=446 count=1

Switched HDD (target became hda), then reboot. Screen shows Matrix-like waterfall of binary data except it's flowing upwards. :-)

FYI, the master HDD is a Debian Sarge with LILO for boot up.
 
Old 04-24-2006, 03:06 AM   #11
Emmanuel_uk
Senior Member
 
Registered: Nov 2004
Distribution: Mandriva mostly, vector 5.1, tried many.Suse gone from HD because bad Novell/Zinblows agreement
Posts: 1,606

Rep: Reputation: 53
verbatime copy of mbr you did
so lilo is looking for hda still? Hence you have a lilo error
If I understand ok what you did.
I am no expert

I prefer grub to lilo because one can edit boot line

>>Thus i wonder whether they need to be backed up at all.
It depends what sort of backup you want.
In absolute terms, probably not /proc.
Am not 100% sure about the rest.
If you clone so to be able to revive a system, then you
would have everything. If it was raid you would have everything as well.
Have never tried to revive a linux machine from partial backups
(that is say /usr + /boot /etc but not /proc not /dev).
Can only postulate, sorry

Last edited by Emmanuel_uk; 04-24-2006 at 03:10 AM.
 
Old 04-24-2006, 03:55 AM   #12
jasontn
Member
 
Registered: Feb 2004
Location: Malaysia
Distribution: Fedora Core 2
Posts: 60

Original Poster
Rep: Reputation: 15
I booted up with a Fedore 5 disc 1 and went into linux rescue. Tried to chroot /mnt/sysimage but i get this error message:

Inconsistency detected by ld.so: rtld.c: 1192: dl_main: Assertion `(void *) ph->p_vaddr == _rtld_local._dl_sysinfo_dso' failed!

I proceeded to /mnt/sysimage/sbin/lilo but it complained about lilo.conf

I manually edited /mnt/sysimage/etc/lilo.conf to point to the correct root partitions, but it still complained about /boot/boot-menu.b

What is the correct manner to resolve this?
 
Old 04-24-2006, 06:08 PM   #13
Electro
LQ Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
Use a LIVE Linux CD. Then mount the / partition and any other partitions to /mnt/sysimage. Also mount procfs and sysfs under /mnt/sysimage. Next type 'chroot /mnt/sysimage /bin/bash'. Then type 'source /etc/profile'. Then run lilo to revise the MBR.

If you use Grub, you only have to write to the MBR once. Lilo have to be re-run every time /etc/lilo.conf is revised.
 
  


Reply


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[RAID1, GRUB] Secondary HDD can't boot up when primary HDD fails Akhran Linux - Newbie 2 05-04-2006 04:17 AM
how to do a dual boot (Windows on portable HDD) linux on computer HDD izquierdista Linux - General 5 01-28-2006 09:50 AM
Trying to add a third hard drive (hdd) and get Unable to open /dev/hdd MikeyCarter Linux - Hardware 4 12-26-2005 10:27 PM
How to make mirror image of linux partion to one1 HDD TO 2 HDD raj_1 Linux - General 2 11-04-2004 01:45 AM
How to format & mount 2nd hdd after FedCor1 has been installed on 1st hdd? clay394 Fedora 1 05-18-2004 01:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 04:41 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration