LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 05-26-2012, 10:24 AM   #1
pgibsonorg
LQ Newbie
 
Registered: Aug 2011
Posts: 8

Rep: Reputation: Disabled
Can I "Back up" my system by copy and paste? (ext4)


I've got my linux laptop (CentOS 6) with many source-built applications, lots of modified configuration, and a few spare keywords in the grub config.
I'm hoping to (restore-ably) back up the entire system by simply copying all the files on the root partition, and the relevant ones in the /boot partition.
Is this do-able? is it straightforward?
Am I crazy? lol.

I know there are other backup options but I figured this may be easier to restore from.
 
Old 05-26-2012, 10:33 AM   #2
Teufel
Member
 
Registered: Apr 2012
Distribution: Gentoo
Posts: 237

Rep: Reputation: 50
you can save image of entire partition including mbr. It's a most easy way. Acronis or dd can help you. Copy/paste doesn't restore main boot record.
 
1 members found this post helpful.
Old 05-26-2012, 10:37 AM   #3
pgibsonorg
LQ Newbie
 
Registered: Aug 2011
Posts: 8

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Teufel View Post
you can save image of entire partition including mbr. It's a most easy way. Acronis or dd can help you. Copy/paste doesn't restore main boot record.
Yes of course, but would this only be required for the boot partition? or both? If simply copy/paste works for the root partition it would reduce the space needed (dd a drive of mostly empty space seems a bit overkill)

Having a separate boot partition has it's advantages, is this one of them?
 
Old 05-26-2012, 06:40 PM   #4
Teufel
Member
 
Registered: Apr 2012
Distribution: Gentoo
Posts: 237

Rep: Reputation: 50
If you have two partitions (/boot and /) you can save root (/) as simple gzip archive. But I am not sure this way is correct for /boot. As well you can't save mbr in this manner.
Also you can combine dd with gzip in order to reduce image size (if you confused with empty space).
Something like this:
Code:
# dd if=/dev/sda conv=sync,noerror bs=64K | gzip -c > /mnt/sdb1/sda.img.gz
here /dev/sda is disk you want to backup, /mnt/sdb1 - destination partition for saving backup archive (usb stick/hard e.t.c.)

and how to restore it from archive:
Code:
# gunzip -c /mnt/sdb1/sda.img.gz | dd of=/dev/sda conv=sync,noerror bs=64K

Last edited by Teufel; 05-26-2012 at 06:42 PM.
 
Old 05-26-2012, 11:00 PM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,491

Rep: Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077
Allow me to toss in dissenting view.
"dd" is absolutely unequivocally the worst option for backup. Especially with "noerror".

Use a filesystem aware tool like rsync or cp so you know if/when the source has errors. Better to find out right there, right then. Likewise, copying MBR is very dodgy - any change to partitions after the backup is just a disaster waiting to happen. Just reinstall the boot-loader (to the MBR, not a complete package re-install) after any restore.

Last edited by syg00; 05-27-2012 at 01:47 AM. Reason: typo
 
Old 05-27-2012, 05:24 AM   #6
Teufel
Member
 
Registered: Apr 2012
Distribution: Gentoo
Posts: 237

Rep: Reputation: 50
Yes, if you need just a files copy you can use cp, but cp doesn't give you image.
"conv=sync,noerror" option preserves real image size if some blocks are unreadable.
Also if you going to change your partitions (size, order, GUID e.t.c.), the best way to restore is just fresh installation from distribution media.
 
Old 05-27-2012, 07:32 AM   #7
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,693
Blog Entries: 54

Rep: Reputation: 2961Reputation: 2961Reputation: 2961Reputation: 2961Reputation: 2961Reputation: 2961Reputation: 2961Reputation: 2961Reputation: 2961Reputation: 2961Reputation: 2961
I agree with the rsync option because with Centos, and basically any RPM-based installation, you wouldn't need backups of /bin, /sbin, /usr and those other areas that hold libraries, binaries, etc, etc the system only modifies on installation and update. RPMDB output should be enough to rebuild a system, leaving only contents that have changed like /boot/grub*, /selinux, /etc, /var (need some exclusions there as you don't need cache/yum for example), /root and /home. And if you rsync inside a script you can easily save the MBR to file and have it backed up as well.
 
  


Reply

Tags
backup


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] need to copy all " *.SEED " files and paste them inside a new folder each time rastin_nz Programming 1 11-03-2010 06:02 PM
Disable xorg's "highlight to copy, middle click to paste" clipboard tromboneman Linux - Newbie 1 06-08-2008 12:53 PM
Slack 11 Konqueror: "System:/" shows no icons. How do I get them back MonctonJohn Slackware 0 02-04-2008 08:24 PM
How do i "copy" one bios and "paste" it onto another identical machine Yerp Linux - Hardware 2 01-10-2007 09:31 PM
How to "copy" system image to new server beartooth Linux - General 2 04-26-2005 06:44 AM


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