LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-19-2009, 01:20 PM   #1
BallsOfSteel
Member
 
Registered: Mar 2008
Location: Florida
Distribution: Fedora mainly, but I am open to others.
Posts: 273

Rep: Reputation: 34
Just a little help before I kill anything with dd...


Hey,

Situation: I have an older, slower computer that I am replacing with a new one that I'm building. So, computer A (old) is being replaced with computer B (new).

I want to copy hard drive A, which is an old IDE drive, to hard drive B which is a faster SATA drive. I will be using my laptop to copy A to be B via external USB enclosures. So, in the end, I'd like the new drive to be bootable in the new computer. Which, if I'm not mistaken, the dd command will accomplish.

So, would the command I use be:
Code:
dd if=/dev/sdb1 of=/dev/sdc1 bs=4096 conv=notrunc,noerror
I know if= is the SOURCE and of= is the DESTINATION.

I know the /dev/sd* will vary depending on what the drives show up as.

Is that right and should I need to format the hard drive first?

Thanks.

Last edited by BallsOfSteel; 05-19-2009 at 01:25 PM.
 
Old 05-19-2009, 01:50 PM   #2
jan61
Member
 
Registered: Jun 2008
Posts: 235

Rep: Reputation: 47
Moin,

yes, if (= Input File) is the source, of (= Output File) is the destination.

You don't need to format the disk IMHO, but if you write to a partition (like sdc1), you have to create the partitions first.

Jan
 
Old 05-19-2009, 02:49 PM   #3
BallsOfSteel
Member
 
Registered: Mar 2008
Location: Florida
Distribution: Fedora mainly, but I am open to others.
Posts: 273

Original Poster
Rep: Reputation: 34
Good catch, Jan... I don't think I need to identify a partition. I think the hard drive is just one big partition.

The hard drives will be equal size, too.

I'm only a little concerned about the drive needing to be formatted first. Anyone else care to elaborate on that?

Also, any idea on how long this will take? The source is an 80GB drive with 25GB used. It will be going over USB 2.0. I'm anticipating anywhere between an 1 1/2 - 2 1/2 hours.

Last edited by BallsOfSteel; 05-19-2009 at 02:55 PM.
 
Old 05-19-2009, 03:36 PM   #4
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Quote:
Originally Posted by BallsOfSteel View Post
Good catch, Jan... I don't think I need to identify a partition. I think the hard drive is just one big partition.
It all depends on what do you want to do, really. dd just read and write bytes, it is not concerned about file systems, formats or any other higher level thing. It just copy bytes from point A to point B and that's about everything it understands. For dd, file system structures and the proper data which forms our files are both the same thing. So it also copies the "formatting".

So, if you use if=/dev/sdc you will be making a 1:1 image of the whole contents of the device. Boot sector, partitions and filesystems included. Also including the free space, since for dd it's not really free. It will still copy whatever it can read.

A thing you should be concerned about when using dd is that if the destination disk is not exactly of the same size (or bigger) then the end of your file system will not be ok, and that can cause some serious problem if not fixed.

Quote:
I'm only a little concerned about the drive needing to be formatted first. Anyone else care to elaborate on that?
If you are copying a whole filesystem you don't need to format previously. The whole device you use will be overwritten with whatever you throw into it. So, if you plan to dd sdc to sda you can just do "dd if=/dev/sdc of=/dev/sda". If you plan to do it at partition level instead you first must make sure that sda1 is of the same size of sdc1, and proceed the same. You don't need to format sda1.

Quote:
Also, any idea on how long this will take? The source is an 80GB drive with 25GB used. It will be going over USB 2.0. I'm anticipating anywhere between an 1 1/2 - 2 1/2 hours.
Expect a longer time at least to read the IDE drive. Which takes me to the next point: why at all do you want to use dd when you could just use tar -cfzpf instead? The image would be much smaller, and more importantly, you wouldn't be copying 55 GBs of empty space. Yes, you need to create the partitions by hand and format them, but that's the only extra step. Even with dd, you still need to adjust the bootloader config and fstab.

Last edited by i92guboj; 05-19-2009 at 03:38 PM.
 
Old 05-19-2009, 03:53 PM   #5
BallsOfSteel
Member
 
Registered: Mar 2008
Location: Florida
Distribution: Fedora mainly, but I am open to others.
Posts: 273

Original Poster
Rep: Reputation: 34
Quote:
Originally Posted by i92guboj View Post
Expect a longer time at least to read the IDE drive. Which takes me to the next point: why at all do you want to use dd when you could just use tar -cfzpf instead? The image would be much smaller, and more importantly, you wouldn't be copying 55 GBs of empty space. Yes, you need to create the partitions by hand and format them, but that's the only extra step. Even with dd, you still need to adjust the bootloader config and fstab.
I'm not familiar with that tar command. This is my first venture into copying one drive on to another. Mind you, this is a Windows box. Normally I'd reinstall everything... however, this is a box that we use to run a program that runs steel buildings for us. I just don't feel like going through all of the leg work of reinstall everything. I thought that dd would be faster and easier.

If you have a more efficient way, please tell.
 
Old 05-19-2009, 04:38 PM   #6
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Quote:
Originally Posted by BallsOfSteel View Post
I'm not familiar with that tar command. This is my first venture into copying one drive on to another. Mind you, this is a Windows box. Normally I'd reinstall everything... however, this is a box that we use to run a program that runs steel buildings for us. I just don't feel like going through all of the leg work of reinstall everything. I thought that dd would be faster and easier.

If you have a more efficient way, please tell.
Oh, I didn't know that the drive you want to backup was a windows install. Then by all means use dd. Windows is dumb like a donkey and will break if you copy the files or compress them with tar. A disk image is probably better if it's windows which you want to backup.
 
Old 05-19-2009, 08:23 PM   #7
BallsOfSteel
Member
 
Registered: Mar 2008
Location: Florida
Distribution: Fedora mainly, but I am open to others.
Posts: 273

Original Poster
Rep: Reputation: 34
Are you suggesting I make an image first and THEN dd on to the new drive?
 
Old 05-19-2009, 08:55 PM   #8
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,128

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
Mmmm - I don't like dd for this sort of thing. And when you say the disks will be the same size, be very careful. Even same models from the same manufacturer can differ in total cylinder count. As stated above, ensure the target is larger (or at least not smaller).
Copying 80 Gig one sector at a time will take ages - better hope that's a USB 2.0 spec.

Personally I don't screw around like that with NTFS too much, but if I did I'd be looking at ntfsclone. Filesystem aware copying is always better IMHO - but note the warnings on copying NTFS boot partitions. Seeing as it's a separate disk, you can always retry if it does fail.
 
Old 05-19-2009, 11:02 PM   #9
okos
Member
 
Registered: May 2007
Location: California
Distribution: Slackware/Ubuntu
Posts: 609

Rep: Reputation: 38
Before you do anything, I suggest you read this tutorial.
http://www.nilbus.com/linux/disk-copy.php

It worked successfully for me without issue. This was the only thing that worked.

See my thread.
http://www.linuxquestions.org/questi...dows+partition


It is very critical that the source disk is the exact same size as the destination disk.

Hope this helps.

Last edited by okos; 05-19-2009 at 11:03 PM.
 
Old 05-20-2009, 03:33 AM   #10
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
However, now that I remember you are going to have problem if the names are named differently. Windows hardcode things, and that means that if you dd from disk A to disk B a windows install when disk A is IDE and disk B is SATA, then the installation will break. I've seen how windows is unable to boot when you just change a SATA disk to IDE emulation mode on the BIOS. So I guess that you are going to have problems no matter what you do.
 
  


Reply



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
What if 'kill -9' fails to kill a task? chii-chan Linux - Newbie 15 03-27-2013 03:47 PM
[SOLVED] Kill a hung task when kill -9 doesn't help 10110111 Linux - General 4 04-02-2009 11:10 AM
Use only one "kill" to kill father and child processes Xosen Programming 7 08-28-2008 03:33 AM
how to use kill to kill a batch of processes with same name? dr_zayus69 Linux - Software 2 09-03-2005 06:35 PM
cannot kill process (kill -9 does not work) mazer13a Linux - General 1 05-27-2005 02:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:49 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