[SOLVED] Need correct syntax for creating HDD clone with dd command
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
@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.
If you don't have NFS setup yet, then you'll need to do that first. I recommend <http://nfs.sourceforge.net/nfs-howto/> 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.
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:
Code:
fdisk -l
Also tell us from where to where you want to clone.
@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.)
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).
@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.
Last edited by netraider; 06-22-2012 at 05:11 PM.
Reason: clarification
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.
@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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.