LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 07-02-2003, 05:12 PM   #1
peterhf
LQ Newbie
 
Registered: Jul 2003
Posts: 1

Rep: Reputation: 0
duplicating contents of a HD


How do I copy a bootable hd to a second hd that will boot?

Thanks in advance for any help extended.

Peter -
 
Old 07-02-2003, 05:19 PM   #2
KevinJ
Member
 
Registered: Feb 2001
Location: Colorado Springs, CO
Distribution: Redhat v8.0 (soon to be Fedora? or maybe I will just go back to Slackware)
Posts: 857

Rep: Reputation: 30
boot the system to a linux rescue disk, like the RedHat install CD or maybe Tom's RTBT. Do not mount your good Linux install. Assuming your good Linux install is on /dev/hda and you want to copy to /dev/hdb ....

dd if=/dev/hda of=/dev/hdb

works best if hard drives have identical geometry.

-KevinJ
 
Old 07-02-2003, 11:50 PM   #3
mlp68
Member
 
Registered: Jun 2002
Location: NY
Distribution: Gentoo,RH
Posts: 333

Rep: Reputation: 40
yes, that works if the drives have the same geometry, but I find that they almost never do -- even if you buy, say, two Maxtor disks with what looks like the same name 6 weeks apart, the geometry is usually different.

There is a more generic (and also faster) procedure which I use in a different way to make an "image backup" of my systems (and also use for cloning purposes). There is an old post of mine at
http://www.linuxquestions.org/questi...338#post295338
about this.

To go from disk to disk, make sure that the *new* disk is what it's gonna be later, such as /dev/hda. Your existing boot disk would be, say, /dev/hdc temporarily.

Then boot a rescue disk (in that post I have a pointer to one that I maintain that will do the trick, but the Redhat disk will suffice). Then, on the virgin /dev/hda make matching partitions as they are on your "good" boot disk. Be very careful not to confuse the disks... you can use fdisk and type the numbers, or use sfdisk -d to capture the partition info and make the other disk the same. Format the file systems on the new disk.

Then, mount each partition pair ( eg /dev/hda1 (=to) and /dev/hdc1 (=from) ), and cp -a or tar the contents from -> to.

Finally, end up with your later / partition mounted, in this example, as /to and run

lilo -r /to

(that's why it has to be what it will be later, e.g, /dev/hda )

The reason why this is faster in addition to geometry-independent is that with dd you copy each byte on the disk, even the unused ones. With that procedure, you copy only the actual files, which can be a lot less.

Hope it helps,

mlp
 
Old 07-03-2003, 12:35 PM   #4
Pcghost
Senior Member
 
Registered: Feb 2003
Location: The Arctic
Distribution: Fedora, Debian, OpenSuSE and Android
Posts: 1,820

Rep: Reputation: 46
I would check out Power Quests Drive Image program. It's not open source but it is the be-all-end-all of drive copy utilities. It handles different drive geometries well.
 
Old 07-03-2003, 12:59 PM   #5
Half_Elf
LQ Guru
 
Registered: Sep 2001
Location: Montreal, Canada
Distribution: Slackware; Debian; Gentoo...
Posts: 2,163

Rep: Reputation: 46
boot from something (floppy, installation cd, KNOPPIX).
mount the two hard drive (if you have more than one partition, mount every one).

then do something like
cp -a /mnt/old /mnt/back_up (I'm assuming that /mnt/old is your old hd and /mnt/back_up is the new one)

this will do the job, no matter the hd size. All you have to do then, it to install lilo on your new hd.
 
Old 08-08-2003, 03:22 AM   #6
chongman99
LQ Newbie
 
Registered: Aug 2003
Location: Berkeley, CA
Distribution: Morphix 0.4 (Debian based)
Posts: 21

Rep: Reputation: 0
Follow up question from someone else:

I have several partitions and want to move my linux on hda5 to hda12.

=====
1st: Copy the contents.

hda5 is about 20 GB, with only 1GB full.
hda12 is about 5 GB, completely empty.

I booted up with MORPHIX (like Knoppix, live-CD), mounted both drives and then did the following:

cp -a /mnt/hda5 /mnt/hda12

=====
2nd: modify LILO to boot off hda12.

change /etc/lilo.conf

root=/dev/hda12


Just wondering, will this work? Will there be any problems with hda12 thinking things need to be on hda5 (like do partitions know what they are?)? Is there something that will look like it worked but really didn't?

I'm gonna try it and get back to y'all
 
Old 08-08-2003, 04:16 AM   #7
chongman99
LQ Newbie
 
Registered: Aug 2003
Location: Berkeley, CA
Distribution: Morphix 0.4 (Debian based)
Posts: 21

Rep: Reputation: 0
It worked!

What I just described above worked, moving a distro from one partition to another.

The only problem I had was with LILO. I need to learn more about having more than one distro and how to handle the boot drive issue. (I have a boot partition on /dev/hda2).
 
Old 08-08-2003, 07:08 AM   #8
Half_Elf
LQ Guru
 
Registered: Sep 2001
Location: Montreal, Canada
Distribution: Slackware; Debian; Gentoo...
Posts: 2,163

Rep: Reputation: 46
yeah it should work well, you will just need some ajustement to your boot loader (or to completly reinstall the boot loader if you are moving to a new HD) but 'cept that, it should goes well.

Moving a *nix system is pretty easy... not like Windoze
 
Old 08-11-2003, 09:22 AM   #9
ksnash
Member
 
Registered: Jul 2003
Location: Pensacola,Florida
Distribution: Mandrake 9.1
Posts: 41

Rep: Reputation: 15
If you could find the appropriate blocksize you could set count.
ie: dd if=/dev/hda of=/dev/hdb ibs=4096 count=250k
partition information will be wrong though.
 
Old 08-12-2003, 04:30 PM   #10
chongman99
LQ Newbie
 
Registered: Aug 2003
Location: Berkeley, CA
Distribution: Morphix 0.4 (Debian based)
Posts: 21

Rep: Reputation: 0
Boot partition still points to old root partition

So I moved my linux root from hda5 to hda12. My boot partition is on hda5.

While booted into hda5, I added the options into lilo with the
same boot image and two entries, the only difference is that one has root=/dev/hda12 and the other has root=/dev/hda5.


Here's the funky thing. Even when I load the /dev/hda12 one, /dev/hda5 gets mounted and set as root in the bootup.

My guess is that it is either:
1) Something on my boot partition that has a global reference to /dev/hda5.
2) Something in the bootup process (initd routines) has a global reference to /dev/hda5

I've got no clue how to figure this out though, so any help is appreciated.

==========

I am running Morphix (which may be part of the problem), but I'd be curious if this were something common to debian.

Has anyone moved their debian partition after install and not had to deal with something in the boot sequence deciding to mount the old drive?
 
  


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
Duplicating a Login Screen darknessvb Linux - Newbie 2 10-24-2004 01:52 AM
Duplicating Copyrighted CD's? The_Nerd Linux - Software 5 04-29-2004 03:02 PM
duplicating linux installs ozzy_cow Linux - General 3 04-26-2004 10:39 PM
duplicating a webserver jasoncngo Linux - Software 6 04-07-2003 01:37 PM
Duplicating DSL connection Half_Elf Linux - Networking 4 07-19-2002 10:05 AM

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

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

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