LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-19-2012, 03:15 PM   #1
Anony999
LQ Newbie
 
Registered: Apr 2012
Posts: 5

Rep: Reputation: Disabled
Talking DD command Question


Hi

Newbie (ish) - done lots of dos, windows, C, Mac stuff and did some Ubuntu bits and bobs some years back and just getting back into it

Looking at the dd command for making a disk image, i have a couple of questions

I have a server and a nas box

Can i run the dd command from the server live to clone the entire drive as a disk image to the nas box

The server is running Cent OS 6, KVM, cloud linux with various extras...

FIrst of many questions as i am a newbie server admin (for myself) and getting into lots of reading
 
Old 04-19-2012, 04:32 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Hi, welcome to LQ!

And you most certainly can. I'd recommend piping dd's output
through gzip or some such to make the image smaller...

Code:
dd if=/dev/<server_hd> bs=4096 | gzip > /path/to/NAS/server.img.gz


Cheers,
Tink
 
Old 04-19-2012, 04:54 PM   #3
jefro
Moderator
 
Registered: Mar 2008
Posts: 15,506

Rep: Reputation: 2235Reputation: 2235Reputation: 2235Reputation: 2235Reputation: 2235Reputation: 2235Reputation: 2235Reputation: 2235Reputation: 2235Reputation: 2235Reputation: 2235
Here is the problem with a live dd unless you have some sort of shadow copy. Even then some database apps might cause some issue. dd can't pick a single point in time. The system will keep working and moving files and changing during the hour or so this is going on.

Personally, I'd boot to a live cd/usb or pxe it to some image then run the backup. Be sure you know how to stop and restart any apps.

Tinkster did answer your question directly but you have to decide which is best. I don't know of any open sourced way to get a shadow copy on linux. A commercial company offers a way.

Last edited by jefro; 04-19-2012 at 04:55 PM.
 
1 members found this post helpful.
Old 04-19-2012, 05:33 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Quote:
Originally Posted by jefro View Post
Here is the problem with a live dd unless you have some sort of shadow copy. Even then some database apps might cause some issue. dd can't pick a single point in time. The system will keep working and moving files and changing during the hour or so this is going on.

Personally, I'd boot to a live cd/usb or pxe it to some image then run the backup. Be sure you know how to stop and restart any apps.

Tinkster did answer your question directly but you have to decide which is best. I don't know of any open sourced way to get a shadow copy on linux. A commercial company offers a way.

True true ... not sure what I was thinking of; I normally only use dd for clones if
the machine was booted of a live CD. Anything that is in read/write state may (will
most likely) be unclean on the copy.
 
Old 04-20-2012, 02:44 AM   #5
Anony999
LQ Newbie
 
Registered: Apr 2012
Posts: 5

Original Poster
Rep: Reputation: Disabled
Thanks

So is there much difference between dd booted from a live cd and CloneZilla then ?
 
Old 04-20-2012, 03:03 AM   #6
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
A friendlier interface in clonezilla ...
 
Old 04-20-2012, 08:24 AM   #7
Satyaveer Arya
Senior Member
 
Registered: May 2010
Location: Palm Island
Distribution: RHEL, CentOS, Debian, Oracle Solaris 10
Posts: 1,415

Rep: Reputation: 305Reputation: 305Reputation: 305Reputation: 305
Adding to all these, here is also a very helpful thread you can check, Learn the DD command.
 
Old 04-20-2012, 10:17 AM   #8
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
As well as not having the file system in use (not mounted ensures that), if you are going to compress the image (good idea) then it is worth zeroing out all the unused space before.

With some other Linux OS booted (Live CD/DVD such as Knoppix, USB, PXE ...), for each file system on the HDD you want to back up in turn do
Code:
mount /dev/<whatever> /mnt/hd
dd if=/dev/zero of=/mnt/hd/zeroes; rm /mnt/hd/zeroes
umount /mnt/hd
 
Old 04-20-2012, 10:47 AM   #9
Anony999
LQ Newbie
 
Registered: Apr 2012
Posts: 5

Original Poster
Rep: Reputation: Disabled
Thanks

I did look at the Linux DD thread

I think for this instance ill stick with CloneZilla which im familiar with and is very good

Been an interesting read on here

WIll be back soon with more questions im sure
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
cp command question Freestone Linux - Newbie 4 05-01-2006 10:39 AM
Question About a Command? carlosinfl Linux - General 4 10-28-2005 01:51 PM
Command question satimis Fedora 3 04-04-2005 01:24 AM
ls command question eastj1974 Linux - Newbie 4 11-18-2003 06:44 PM
Command Question Siki Linux - General 3 07-29-2003 04:34 PM


All times are GMT -5. The time now is 10:21 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration