-   Slackware (
-   -   Need correct syntax for creating HDD clone with dd command (

netraider 06-21-2012 03:47 PM

Need correct syntax for creating HDD clone with dd command
I have been struggling to create an image of my HDD with dd. Can anyone help me remember the correct syntax please? Thanks in advance.

ukiuki 06-21-2012 04:23 PM

Here you can find all you need:


H_TeXMeX_H 06-22-2012 06:57 AM

I recommend using:


You can do it with dd, but it's not as easy or reliable. dd can do a lot, but maybe it shouldn't be used for everything.

netraider 06-22-2012 02:19 PM

@ukiuki & @H_TeXMeX_H, thank you very much. Your insight has been most useful.

netraider 06-22-2012 02:44 PM

@ukiuki, thanks again. There was some very useful information gathered from the link you posted. However, my problem still remains. I afraid to say it, but I still need help. I am somewhat a newbie and some of the information contained on that page was somewhat cryptic to me at best. I would like it if someone could post an example using the dd command to clone a HDD and save it to a nfs.

Here are the details of my nfs:

hostname (- the domain name) : nas1
target directory on nas where I would like to save the image: /linuxbkps
location to mount nfs to linux filesystem (which I am cloning): /mnt/linuxbkps

Also, how would I mount the nfs. I have not had any luck with that either. I need an example using my real details. I have tried the man pages and forums. I am not understanding it at all.


david63025 06-22-2012 04:01 PM

If you don't have NFS setup yet, then you'll need to do that first. I recommend <> to setup the server and client sides. It also covers mounting a remote directory.
Try 'man dd' for a the dd syntax or the link above covers what you need.


ukiuki 06-22-2012 04:09 PM

If DD seen to be too difficult then it is easier to use Clonezilla, if all you need is to clone a hard drive or partition, that is the tool! Unless you really want to learn DD, if so, please tell us what are your hdd(s) settings, open terminal and as root do:

fdisk -l
Also tell us from where to where you want to clone.


netraider 06-22-2012 04:35 PM

@ukiuki, thanks for taking the time to help. I understand that Clonezilla is an easy alternative, however, I do like to do things the hard way. With that said, yes, I would very much like to learn DD. I have a never ending thirst for knowledge and I am eternally greatful for any help that will allow me to achieve it.

Here is are the settings of my hdd:

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000b3a73

Device Boot Start End Blocks Id System
/dev/sda1 63 3903794 1951866 82 Linux swap
/dev/sda2 * 3903795 5863724 979965 83 Linux
/dev/sda3 5863725 976773167 485454721+ 83 Linux

I want to clone the entire disk with all partitions; MBR (everything on disk & intact). I wish to save it to my NAS. I created the NFS share /linuxbkps on the / directory of the NAS and was instructed to use /raid0/data/linuxbkps as the mount point. I have made several attempts and failed at connecting the NFS, but I will read through the information that David has just furnished me and give it another go. In the mean time, if I could just learn dd. I will be somewhat fulfilled.

This is how I attempted the process: (sorry, I do not yet know how to enter syntax in a code box within this forum, but I will learn.)

# dd if=/dev/sda of=/nas1.domain/linux.dd_bs512 bs=512

I know I have probably got it all wrong.

netraider 06-22-2012 04:42 PM

@david62035 thanks for the info. I will read up on it.

ukiuki 06-22-2012 04:48 PM

Let me understand one thing, do you have only one hard drive? If yes, well you can't clone the entire hdd, if you don't have another hdd where to send all the data. When you issue dd if=/dev/sda you are saying to dd to copy/clone the whole drive, so 500GB and you'll need another 500BG at least to send all that data to. Now if you are trying to send it to somewhere in the network, again you still need over there 500GB space where it can fit, i do not know if dd will work that way. The syntax looks correct, dd if=/(from) of=/(to).


netraider 06-22-2012 05:09 PM

@ukiuki, you are correct. I have only one physical hdd in my Linux box. The other drive is contained within my NAS. The NAS houses 5 1TB hdd's configured in a RAID 5 which has reduced my overall capacity to a total of 2788.9 GB with some data already contained on the stripe, of course. I am hoping that it is in fact possible to save to the NAS. I have heard that is was, but was given no specific information as to how to do it. I have not found a proper example that would help me either.

Should this be sufficient as far as capacity? Where do you suggest that I look to gather more information on the possibility of saving the image over the network using dd? And if I were able to mount an NFS share to the filesystem, would it suffice as a local backup drive?

I had hoped to mount the NFS share to /mnt/linuxbkps and from that point, instruct dd to create the image of /dev/sda and push it to /mnt/linuxbkps , which would in theory, save it to the NAS.

ukiuki 06-22-2012 08:44 PM

Try this:
Also search for dd over network.


allend 06-22-2012 10:38 PM

I would not recommend the use of ssh in a home situation as it will be very slow.

This should a relatively straightforward task.
1. Boot the system from a CD with a Linux system that has NFS support.
2. Configure networking. (Check that your network interface is detected with 'ifconfig'. If you have an external DHCP server, enter 'dhcpcd' to get the network address and gateway assigned. Otherwise follow procedures for setting up a static IP address)
3. Mount the remote NFS share on a local mount point /mnt/tmp (you may need to create this with 'mkdir /mnt/tmp') with 'mount nas1:/linuxbkps /mnt/tmp'
4. Create the image with 'dd if=/dev/sda of=/mnt/tmp/<image name> bs=4096'. Depending on your setup, a larger block size may give better performance.

netraider 06-25-2012 11:05 AM

@ukiuki and @allend, thank you both very much, your answers have been most helpful. I have gained the knowledge that I was seeking. I can now happily mark this thread as solved. Thanks again.

I have up'ed your reps.

All times are GMT -5. The time now is 12:00 PM.