Clone drive using Knoppix?

superkdogg

Senior member
Jul 9, 2004
640
0
0
My wife's hard drive is one of the older WD's that have the signature "Western Whine" and it's pretty loud. I have been looking into swapping her HDD, but all the free cloning utils suck (I found one that looked like it was working, but it said it would take 4 days to complete!) and I don't want to have to buy a program to use it once.

My idea is to boot her system under Knoppix with two hard drives-the current one and the one that I want to swap in. Then could I simply copy everything over? I know that I'd probably then need to boot XP from CD the first time to set up the OS to boot from the new HDD, but is there something that I'm missing?

I'm thinking that since none of the windows files would be protected by knoppix or loaded into memory that it just might work, but I'm sure that there's a reason that it won't.

Please fill me in on why this idea won't work or let me know that I can be free of the sound of nails on a chalkboard every time that I walk within 2 rooms of her rig!

TIA

 

drag

Elite Member
Jul 4, 2002
8,708
0
0
I THINK... you can do something like this:

In linux you have device names that corrispond to hardware and abstract resources. They are located in the /dev/ folder.

Harddrives are generally /dev/hd* names, were the * is a, b, c, d, e, f, etc etc.

Now this arrangement can get mucked up a bit with SATA stuff, but generally it goes like this:

/dev/hda = primary master,
/dev/hdb = primary slave.
/dev/hdc = secondary master
/dev/hdd = secondary slave.

Then the partitions would be the harddrive name + the partition number.. So /dev/hdb2 would be the second partition on the primary slave IDE device. /dev/hdc1 would be the first partition on the secondary master. That sort of thing.

So with windows you generally keep the harddrive the primary master, so I'll assume the origin disk would be /dev/hda, the primary master.

The disk you want to copy the contents to would be /dev/hdc, the secondary master.

So you'd go like this at the command line:

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

And that will copy a bit-by-bit copy of the entire contents of the first drive onto the second drive.

This will take a LONG time because even blank space on the first drive will be copied. All the 1's and all the 0's. Similar to a ISO image for a cdrom. The MBR, the partition information, the partitions themselves, everything a exact copy.

And since the new drive is newer then the old drive, I'll assume that its' bigger. So when it's finished copying you'll have a copy of the first disk on the second disk. It should be exact, and if you removed the old one and stuck in the new one it should be bootable.

(You don't want to do this from a bigger drive to a smaller drive. It won't work. Only smaller to bigger.)

However you will have blank space that isn't used for anything becuase the old disk wouldn't be big enough to fill up the new disk.

So then what you need to do is add the unused space as a partition, or resize the original partition to fill up the new harddrive on the new harddrive.

This is the most primitive way that I know how to do it. It should work using knoppix.

Similar technics can be used to make images of partitions and clone drives over networks.

http://www.okmoore.com/imagedrive.html


Hope that makes sense.

be very carefull with the destination and source harddrives.. you can wipe out all your infomration if you goof on the dd command..

dd if= of=

if stands for input file.
of stands for output file.


edit:
Also there is a gui utility that, I believe, can resize NTFS partitions. It's called Qtparted, it can resize other types too.. Linux partitions, FAT32, and such. I is included with knoppix.
 

Budman

Lifer
Oct 9, 1999
10,980
0
0
Wouldnt it be much simpler to download WD's utility & clone the old hd to new this way?

http://support.wdc.com/download/index.asp?cxml=n&swid=1

Instructions:

1. Download the dlgsetup11_win.zip.
2. Extract and run the setup.exe file.
3. Read and accept the license agreement to continue.
4. Once installed, you will be prompted to run the program or may run the program manually from either the programs menu or from the shortcut on your desktop.
5. You will see the following options:
* VIEW INSTALLATION TUTORIAL - Instructions on how to connect your new hard drive to the computer.
* SETUP YOUR HARD DRIVE - Setup a hard drive already connected to your computer.
* DRIVE-TO-DRIVE COPY - Copy all the files or a specific folder from one drive to another.
* HARD DRIVE INFORMATION - Jumper Settings and other technical information about your hard drive.
6. Select the task you wish to perform.

 

superkdogg

Senior member
Jul 9, 2004
640
0
0
Would that work going from WD to another brand? Just curious, as I'd be using another WD for this project-and since I bought it retail, I don't even have to DL that util-I have it on CD!

God I'm dumb sometimes-overlook the easy way and try to find a hard workaround!

:beer: :beer:Here's to you, Budman! :beer::beer:
 

bersl2

Golden Member
Aug 2, 2004
1,617
0
0
Originally posted by: superkdogg
Would that work going from WD to another brand? Just curious, as I'd be using another WD for this project-and since I bought it retail, I don't even have to DL that util-I have it on CD!

God I'm dumb sometimes-overlook the easy way and try to find a hard workaround!

:beer: :beer:Here's to you, Budman! :beer::beer:

dd is a hard workaround?!

Culture shock in progress... :confused:
 

superkdogg

Senior member
Jul 9, 2004
640
0
0
bersl2--It's not like I was implying I couldn't do it. You have to admit it's much harder than clicking next three times and selecting c:->f: and clicking next again (that's including installing the program...). Not hard, but not as easy as the easy way would have been the best way to say it, but I didn't think I needed to use the -v switch for people to understand my point. ;)

However, I think that XP pro may not work with the DL tools anyway. I had supposedly copied over the whole disk with the exception of a log file or two and the pagefile.sys, which DL said was no big deal. I go to reboot and everything is smooth as silk right up to the splash. That's when it stops. I see the dumb light blue Windows XP screen that comes up right before your login under normal circumstances, but my usernames and the "Turn off computer" button never come up. It just stops at the splash screen---anybody have any suggestions?

EDIT: Answered my own question. If you have similar problems, try leaving the source drive in the machine and swapping the master/slave of the two drives. I don't know why that mattered, but it booted with the new drive as master with the old one as slave and wouldn't do it with just the new drive in there.
 

stuntman242

Member
Feb 8, 2005
59
0
0
You can't just copy all of the files over because just copying the files over wont make it bootable. You will have to use partition app to do this. Knoppix may come with a tool to do this.
 

travers

Junior Member
Apr 1, 2005
4
0
0
Lol, a good place to ask this would be a linux forum.

Knoppix, dd, and fdisk are your friends.

Ok, first thing: which drive is which? On the command line type $su then do a #fdisk -l. If the drives are different sizes, then this will allow you to identify them. I have two different drives in a box of mine and fdisk -l looks like so:

localhost root # fdisk -l

Disk /dev/hda: 13.6 GB, 13600677888 bytes
16 heads, 63 sectors/track, 26353 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

Device Boot Start End Blocks Id System
/dev/hda1 1 26353 13281880+ 83 Linux

Disk /dev/hdb: 15.0 GB, 15020457984 bytes
255 heads, 63 sectors/track, 1826 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hdb1 * 1 1826 14667313+ 83 Linux


If they are the same, use the command #dmesg | grep -i hd This will output the kernel ring buffer, pipe it into grep, which will then display all the lines with the letters "hd" in them. If I do this is looks like so:

travers@AMD64 ~ $ dmesg | grep -i hd
ide0: BM-DMA at 0x2080-0x2087, BIOS settings: hda: DMA, hdb: pio
ide1: BM-DMA at 0x2088-0x208f, BIOS settings: hdc: DMA, hdd: pio
hda: TOSHIBA MK8026GAX, ATA DISK drive
hdc: SD-R2512, ATAPI CD/DVD-ROM drive


So you can see, my hd is /dev/hda and my cd/dvd drive is /dev/hdc.

Ok now, if the new drive is about the same size as the old one, then don't mess around with partitions. But, if that new drive is big and you want to use all the space, then we must make a new partish. Say that the old one is like 10G.

localhost root # fdisk /dev/hda

The number of cylinders for this disk is set to 26353.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-26353, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-26353, default 26353): +10G


You can also do it in Megabytes like Last cylinder or +size or +sizeM or +sizeK (1-26353, default 26353): +4096M

And so we have a 10Gig partish on the new drive. Use windows to partition the rest of it later because it uses logical partitions beyond the fist primary partish where the OS resides. Linux can do logical partitions easy, but it's complicated for a user to setup. (Don't know why Windows uses logical partitions... it's stupid and unnecessary.)

Ok now it's time to use dd. I think Knoppix's version of dd dosen't use the if= or of= (input file, output file) syntax. So do dd /dev/hda /dev/hdb Now, you can monitor dd's progress, but it's complicated and dd might not exit on completion of the task. So just let that run awhile. After like an hour to be safe, hit ctrl-c. And there you have it, two identical filesystems. Take out the old one and put the new one in it's place. Enjoy the silence, albeit it might be disturbing.