LinuxQuestions.org
Review your favorite Linux distribution.
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 05-25-2015, 10:23 AM   #1
sigint-ninja
Member
 
Registered: Feb 2011
Location: Republic Of Ireland
Distribution: Debian,Centos,Slackware
Posts: 451

Rep: Reputation: 29
backing up with dd


hi guys,

i want to back up my centos server that has a few virtual machines on it...i read that some people were saying dd is a very good way to do this. but a lot of people dont cause of fear of the command line.

i would like to write a script that backus up the entire hard drive to a ext usb hard drive.

i have a couple of questions though.

1) am i better off using a cloning software like acronis or storage craft.

2) can dd also restore a system to a bootable state or is it really just a backup.

3) can you still use the system while it is backing up?

thanks...
 
Old 05-25-2015, 10:55 AM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 2,404

Rep: Reputation: Disabled
dd can be used to create a bit-by-bit image of a partition or an entire hard drive. If you restore such a backup to another drive/partition, it will be an exact copy of the original. If the original partition was bootable, the restored copy will be as well.

In general, people don't use dd for regular backup jobs. There are a number of reasons for this, such as these:
  1. dd can only relate to the block device, not the filesystem contained therein. It copies the entire drive/partition, not just the parts containing actual data. The backup will take longer than it needs to, and will also contain all the unused parts of the drive/partition.
  2. It's not possible to use dd to back up a partition or drive containing an active filesystem, if that filesystem is mounted read/write. As dd works its way form the beginning to the end of the drive/partition, the filesystem will be subject to changes and the copy will be inconsistent.
You can sort-of work around problem #1 by piping the data from dd through a compressor like gzip, but as time goes by, the drive/partition will contain an increasing amount of fragments from deleted/temporary files. This negatively affect your ability to compress the unused parts.

(Exception: If your drive is an SSD and the kernel sends "trim" commands to it whenever a file is deleted, the drive will usually just return zeroes if one tries to read a "free" block, and a block of zeroes will compress really well.)

The second issue affects every backup utility, not just dd. The only really good way to eliminate the problem is to dismount the filesystem or at least remount it as read-only (which obviously isn't an option for the root filesystem), or back up a read-only snapshot (requires LVM). Using snapshots means you can use the system while a backup is being performed, although you may experience slightly lower performance/responsiveness than usual.

You're probably better off using a generic backup tool rather than relying on dd. If you use something simple like tar or cpio but also create a small backup of the partition table (and you can certainly use dd to do this), it should be possible to restore the entire system to a bootable state from, say, a live CD/DVD/USB stick.
 
Old 05-25-2015, 11:14 AM   #3
fatmac
Senior Member
 
Registered: Sep 2011
Location: Surrey/Hants Border, UK
Distribution: BSD & Linux - As long as they are Lightweight
Posts: 1,500

Rep: Reputation: Disabled
I think a lot of people use rsync to back up servers.
 
Old 05-25-2015, 02:03 PM   #4
sigint-ninja
Member
 
Registered: Feb 2011
Location: Republic Of Ireland
Distribution: Debian,Centos,Slackware
Posts: 451

Original Poster
Rep: Reputation: 29
thanks for that...

rsync is used for file copying operations...not really for imaging / partition backups...am i right?
 
Old 05-25-2015, 02:23 PM   #5
fatmac
Senior Member
 
Registered: Sep 2011
Location: Surrey/Hants Border, UK
Distribution: BSD & Linux - As long as they are Lightweight
Posts: 1,500

Rep: Reputation: Disabled
Correct, it can back up your filesystem & data, & does incremental backups also. If you had a catastrophic failure, you would have a recent back up of all your files to re install.

Clonezilla might be of interest if you really do want to back up your whole drive.
 
Old 05-25-2015, 08:19 PM   #6
jefro
Moderator
 
Registered: Mar 2008
Posts: 15,383

Rep: Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198
There is a commercial live copy software much like windows' shadow copy service.
That is the only way I know of to do live full backups.

Generally you don't need full backups. Your plan is what you like to do however. I tend to create a golden image of full install then once in a while copy off user data.

The vm's are pretty easy usually if you have an advanced vm. Depending on what is running on the vm you may or may not have to shut down fully.
 
  


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
[SOLVED] Backing Up ubuntunewby Linux - Newbie 1 07-01-2011 01:08 PM
Backing up my OS dougnc Linux - Software 4 07-02-2007 11:17 AM
Backing up ChristineCrawford Linux - Newbie 8 12-17-2005 08:21 AM
backing up coheed Linux - Software 4 01-25-2004 10:01 PM
Backing up osx Linux - General 5 03-24-2003 03:09 PM


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