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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
04-17-2006, 04:30 AM
|
#1
|
Member
Registered: Feb 2004
Location: Malaysia
Distribution: Fedora Core 2
Posts: 60
Rep:
|
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.
|
|
|
04-20-2006, 05:34 AM
|
#2
|
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:
|
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)
|
|
|
04-20-2006, 08:32 PM
|
#3
|
LQ Guru
Registered: Jan 2002
Posts: 6,042
Rep:
|
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.
|
|
|
04-20-2006, 08:47 PM
|
#4
|
Member
Registered: Apr 2006
Location: Pittsburgh
Distribution: Debian Sid AMD64
Posts: 296
Rep:
|
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.
|
|
|
04-21-2006, 02:47 AM
|
#5
|
Member
Registered: Feb 2004
Location: Malaysia
Distribution: Fedora Core 2
Posts: 60
Original Poster
Rep:
|
The kitten (HDD) i inherited was a result of a cat. :-)
I'll try the suggestions and post my outcome later. Thanks.
|
|
|
04-21-2006, 10:19 AM
|
#6
|
Member
Registered: Jun 2004
Location: Britain
Distribution: Slackware
Posts: 186
Rep:
|
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.
|
|
|
04-23-2006, 11:22 PM
|
#7
|
Member
Registered: Feb 2004
Location: Malaysia
Distribution: Fedora Core 2
Posts: 60
Original Poster
Rep:
|
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?
|
|
|
04-24-2006, 02:16 AM
|
#8
|
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:
|
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
|
|
|
04-24-2006, 02:36 AM
|
#9
|
Member
Registered: Feb 2004
Location: Malaysia
Distribution: Fedora Core 2
Posts: 60
Original Poster
Rep:
|
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.
|
|
|
04-24-2006, 03:58 AM
|
#10
|
Member
Registered: Feb 2004
Location: Malaysia
Distribution: Fedora Core 2
Posts: 60
Original Poster
Rep:
|
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.
|
|
|
04-24-2006, 04:06 AM
|
#11
|
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:
|
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 04:10 AM.
|
|
|
04-24-2006, 04:55 AM
|
#12
|
Member
Registered: Feb 2004
Location: Malaysia
Distribution: Fedora Core 2
Posts: 60
Original Poster
Rep:
|
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?
|
|
|
04-24-2006, 07:08 PM
|
#13
|
LQ Guru
Registered: Jan 2002
Posts: 6,042
Rep:
|
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 09:08 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|