LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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, 09:23 AM   #1
sigint-ninja
Member
 
Registered: Feb 2011
Location: Republic Of Ireland
Distribution: Debian,Centos,Slackware
Posts: 508

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, 09:55 AM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,338

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, 10:14 AM   #3
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,484

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

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, 01:23 PM   #5
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,484

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, 07:19 PM   #6
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,976

Rep: Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623
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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:58 AM.

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