LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   cat cloned hdd on different hdd models (https://www.linuxquestions.org/questions/linux-hardware-18/cat-cloned-hdd-on-different-hdd-models-435891/)

jasontn 04-17-2006 03:30 AM

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.

Emmanuel_uk 04-20-2006 04:34 AM

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)

Electro 04-20-2006 07:32 PM

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.

ataraxia 04-20-2006 07:47 PM

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.

jasontn 04-21-2006 01:47 AM

The kitten (HDD) i inherited was a result of a cat. :-)

I'll try the suggestions and post my outcome later. Thanks.

db391 04-21-2006 09:19 AM

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.

jasontn 04-23-2006 10:22 PM

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?

Emmanuel_uk 04-24-2006 01:16 AM

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

jasontn 04-24-2006 01:36 AM

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.

jasontn 04-24-2006 02:58 AM

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.

Emmanuel_uk 04-24-2006 03:06 AM

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

jasontn 04-24-2006 03:55 AM

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?

Electro 04-24-2006 06:08 PM

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.


All times are GMT -5. The time now is 03:01 PM.