LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-30-2004, 10:48 AM   #1
smegware
LQ Newbie
 
Registered: Mar 2004
Posts: 6

Rep: Reputation: 0
Question Using DD to copy NTFS partition


Hello all

First, I'm new here, forgive me if I've posted this in the wrong forum, it doesn't quite seem right for Hardware to me...

I'm trying to copy an NTFS partition from one drive to another and I'm stuck. I want to copy /dev/hda1 (20Gb NTFS partition on a 60Gb disk) to /dev/hdb (30GB disk, no partitions).

I've tried:
Code:
dd bs=64k in=/dev/hda1 out=/dev/hdb1
Which I picked up from another board, this fails and complains about in being unrecognised. Maybe this was old, anyway I then tried 'if' and 'of' instead:
Code:
dd bs=64k if=/dev/hda1 of=/dev/hdb1
and now get this error: "dd: writing '/dev/hdb1': No space left on device"

Is this because I need to create a partition to write to first? What do I need to do to get this to work? Or am I missing something else?

Thank you in advance

Al :-)
 
Old 03-30-2004, 10:52 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
you will need an exiting partition of the correct size. i think it can also be larger than required, but the extra space will just be lost i.
 
Old 03-30-2004, 11:13 AM   #3
smegware
LQ Newbie
 
Registered: Mar 2004
Posts: 6

Original Poster
Rep: Reputation: 0
Thanks Chris

That made sense to me! I've made a partition on the second disk, I couldn't figure out how to make one the same size because of the geometry diffferences but using the sectors option of fdisk seemed to work like a charm.

So it's dd'ing now, we'll see how it turns out!

Thanks again,

Al
 
Old 03-30-2004, 12:06 PM   #4
fzzy
Member
 
Registered: May 2003
Posts: 31

Rep: Reputation: 15
try partimage

try http://partimage.org/
 
Old 11-25-2008, 03:48 AM   #5
gunnar-eee
LQ Newbie
 
Registered: Aug 2008
Posts: 3

Rep: Reputation: 0
dd works fine if you want to clone a drive to another and don't care about preserving any content on the target drive. In that case no partitions are needed on the target drive, it can be blank the way it comes when new. (File system agnostic) This copies any partitions and their content on the source drive to the target. So if the source is a 160Gb and the target a 320Gb drive then the target has become partitioned as 160GB when finished since it's an exact copy of the source. That can be adjusted later using some partitioning tool.

Example (your device names may vary, take care

sudo dd if=/dev/sda bs=4k of=/dev/sdb
 
Old 11-25-2008, 10:47 AM   #6
Junior Hacker
Senior Member
 
Registered: Jan 2005
Location: North America
Distribution: Debian testing Mandriva Ubuntu
Posts: 2,687

Rep: Reputation: 61
Quote:
Originally Posted by gunnar-eee View Post
sudo dd if=/dev/sda bs=4k of=/dev/sdb
The source drive is 60GB, but the OP said he/she only wants to copy a 20GB partition from the source drive, not the entire drive including the MBR. There may be other partitions on the source drive, it is not common practice to only use a third of a drive and let the other 40GB sit wasted.
This is bad advice in this particular case. DD is dangerous when following bad advice.
If the OP would have asked for a little lesson in using dd, maybe this advice would apply in this case.

Last edited by Junior Hacker; 11-25-2008 at 10:48 AM.
 
Old 11-25-2008, 04:46 PM   #7
rayburn
Member
 
Registered: Jul 2004
Posts: 33

Rep: Reputation: 16
The best tutorial I have ever come across for dd is here:

http://www.linuxquestions.org/questi...light=tutorial

It has become an invaluable reference for me and many others.
 
Old 11-27-2008, 06:59 PM   #8
mjlouis
Member
 
Registered: Nov 2008
Posts: 48

Rep: Reputation: 16
Quote:
Originally Posted by smegware View Post
Hello all

First, I'm new here, forgive me if I've posted this in the wrong forum, it doesn't quite seem right for Hardware to me...

I'm trying to copy an NTFS partition from one drive to another and I'm stuck. I want to copy /dev/hda1 (20Gb NTFS partition on a 60Gb disk) to /dev/hdb (30GB disk, no partitions).
<snip>
Could you use ntfsclone?
Code:
 ntfsclone --overwrite /dev/hdb1 /dev/hda1
Yes, those options are the right way around. Resizing the resulting 20GB image on hdb is an exercise left for the reader...or Google. :-)
 
Old 11-28-2008, 11:53 AM   #9
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by smegware View Post
Thanks Chris

That made sense to me! I've made a partition on the second disk, I couldn't figure out how to make one the same size because of the geometry diffferences but using the sectors option of fdisk seemed to work like a charm.

So it's dd'ing now, we'll see how it turns out!

Thanks again,

Al
If the two disks are reporting different geometries, then dd is likely to fail on the copy.

The last time I did that I was copying an NTFS partition off of a failing disk, and I kept having problems getting a good copy. I finally just created the new partition on the new disk and did a cp -ri from the old partition to the new one.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy files from partition to partition too slow, SATA hard disk.What should I do£¿ Ryanlee SUSE / openSUSE 20 10-31-2005 07:30 AM
Copy files from NTFS to NTFS ThaHackBoy Linux - Hardware 2 05-21-2005 06:36 PM
Copy issue from ntfs Partition under knoppix Aleran Linux - General 1 10-22-2004 09:03 PM
copy ntfs files alb1954 Feather 1 09-15-2004 07:38 AM
What is the code to copy a file from my windows partition to my linux partition? THEBIGFISH Linux - Newbie 3 03-15-2004 10:14 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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