LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices

Reply
 
Search this Thread
Old 02-22-2006, 09:20 PM   #1
kushalkoolwal
Senior Member
 
Registered: Feb 2004
Location: Middle of nowhere
Distribution: Debian Squeeze
Posts: 1,249

Rep: Reputation: 48
easiest way to backup / (root) partition


hi guys,

I would like to back up my root partition on my drive i.e. /dev/hda1 on which I have Debian installed. What is the easiest way to make a compresssed backup copy of the /dev/hda1 partition.

I did an apt-cache search backup

and it seems that there are plenty of utility to achieve this. Has anyone has any personal experience with these kind of tools. Can anyone suggest one based on their own experience.

Thanks

Last edited by kushalkoolwal; 02-22-2006 at 09:48 PM.
 
Old 02-22-2006, 09:37 PM   #2
johnMG
Member
 
Registered: Jul 2003
Location: CT, USA
Distribution: Debian Sarge (server), Etch (work/home)
Posts: 601

Rep: Reputation: 31
You don't usually need to backup the whole drive -- most folks just back up their home directory, since, everything else can just be reinstalled. Your data is the stuff that's tough to replace.

That said, if you want an entire bit-for-bit copy of /dev/hda1, I think the dd command may be what you're looking for.
 
Old 02-22-2006, 09:45 PM   #3
microsoft/linux
Senior Member
 
Registered: May 2004
Location: Sebec, ME, USA
Distribution: Debian Etch, Windows XP Home, FreeBSD
Posts: 1,445
Blog Entries: 9

Rep: Reputation: 45
or you can use tar to make an archive of your root directory(excluding /proc, I think). Then all you need to do is untar it.
 
Old 02-22-2006, 09:48 PM   #4
kushalkoolwal
Senior Member
 
Registered: Feb 2004
Location: Middle of nowhere
Distribution: Debian Squeeze
Posts: 1,249

Original Poster
Rep: Reputation: 48
Quote:
Originally Posted by johnMG
You don't usually need to backup the whole drive -- most folks just back up their home directory, since, everything else can just be reinstalled. Your data is the stuff that's tough to replace.

That said, if you want an entire bit-for-bit copy of /dev/hda1, I think the dd command may be what you're looking for.
Yes I would like to take the snapshot of my entire hard drive partition(/dev/hda1). How can dd be used to have those backups? What about utility like pdumpfs,cpbk?
 
Old 02-22-2006, 10:00 PM   #5
dracae
Member
 
Registered: Feb 2006
Location: Oklahoma
Distribution: Debian Sid and Etch
Posts: 423

Rep: Reputation: 30
dump/restore is a good backup/restore solution. It works with the filesystem and not files so it does not needlessly copy /proc, /sys, /dev, etc. You also have the option of incremental backups.
 
Old 02-23-2006, 01:01 PM   #6
johnMG
Member
 
Registered: Jul 2003
Location: CT, USA
Distribution: Debian Sarge (server), Etch (work/home)
Posts: 601

Rep: Reputation: 31
> How can dd be used to have those backups? What about utility like pdumpfs,cpbk?

Never heard of dumpfs or cpbk.

Google around for a tutorial on using dump and restore. dracae probably knows better than me -- I don't think dd knows to avoid /proc, /sys, and /dev. There's whole books written on doing backups.
 
Old 02-23-2006, 01:53 PM   #7
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD
Posts: 2,032

Rep: Reputation: 309Reputation: 309Reputation: 309Reputation: 309
Quote:
Originally Posted by kushalkoolwal
I would like to back up my root partition on my drive i.e. /dev/hda1 on which I have Debian installed. What is the easiest way to make a compresssed backup copy of the /dev/hda1 partition.
First, you don't want to be writing to the partition while you're backing it up. Second, storing the backup of partition hda1 on some other partition of disk hda does not provide you much protection should hda fail. I suggest booting Knoppix and doing the imaging to a remote system from there. One way I have played with this in the past is (hope I'm remembering the syntax correctly):

Boot Knoppix and open a terminal window:
Code:
$ su
# dd if=/dev/hda1 | gzip | ssh userid@remote_host 'dd of=hda1.gz'
This should give you a compressed copy over on remote_host in userid's home directory. Make sure you have enough disk space there, or alter the destination path to some better place. Of course, not everybody has multiple Linux boxes at their disposal for the above command to work. If you have other Windows boxes available over the LAN you could share one of their drives, mount it to your Linux box using smbfs, and then dd over the network that way.

Alternately, you could make the image and store it locally, then manually transfer it or burn it to a CD or DVD. You're set if you have other partitions where you can store the image (you can't image /dev/hda1 and store it on /dev/hda1 at the same time!) But there's still the issue of not writing to /dev/hda1 while you're imaging it. Again, Knoppix to the rescue.

If you DON'T have other partitions to store the /dev/hda1 image on, it gets trickier. Where are you going to store the thing while it's being created? Direct to CD or DVD might be an option, but I don't know how to do that. There's a program named partimage that may have this capability, but I've never used it and couldn't tell you. Otherwise you'd need to come up with some kind of dd | mkisofs | cdrecord chain of events. I have no idea if that would even be possible.
 
Old 02-23-2006, 02:49 PM   #8
leiavoia
Member
 
Registered: Mar 2002
Distribution: Debian Testing & Kubuntu
Posts: 72

Rep: Reputation: 15
I use rsync and backup to an external HD, for what it's worth. Works good for me.
 
Old 02-23-2006, 05:47 PM   #9
kushalkoolwal
Senior Member
 
Registered: Feb 2004
Location: Middle of nowhere
Distribution: Debian Squeeze
Posts: 1,249

Original Poster
Rep: Reputation: 48
Quote:
Originally Posted by leiavoia
I use rsync and backup to an external HD, for what it's worth. Works good for me.
Ofcourse, I do not intend to backup on the same partition whose back up I want. All I am looking for is to backup my /dev/hda1 from /dev/hdb1(hard disk from which I will boot debian linux) and store the back up either on to a remote server or on /dev/hdb1.

So you guys think that rsync,backup,dd work?

Will dd exclude the /proc /sys and /dev?

Also can you give me example as to how to use rsync and backup?
 
Old 02-23-2006, 05:59 PM   #10
dracae
Member
 
Registered: Feb 2006
Location: Oklahoma
Distribution: Debian Sid and Etch
Posts: 423

Rep: Reputation: 30
Here is the easy way to use dump/restore
mkdir /backup; mount /dev/hdb1 /backup;( dump -0f - / ) | ( cd /backup ; restore -rf - )
 
Old 02-23-2006, 06:00 PM   #11
leiavoia
Member
 
Registered: Mar 2002
Distribution: Debian Testing & Kubuntu
Posts: 72

Rep: Reputation: 15
for rsync, you just do:

$rsync -a /source/folder /destination/folder

That's it!

You can also compress it, but i leave mine uncompressed for quick access and since i could never fill 160GB on the backup drive anyway.

I wrote a dirt-simple perl script that automates it for me. It backs up only the folders i want.
 
Old 02-24-2006, 05:46 AM   #12
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 53
Quote:
apt-get install faubackup
Complete and then incremantal backup, you can directly browse in your backups . Incremental are made by hardlinks. simple, efficient.

Tar can do the same, complete and incremental backup.

Because you maybe not want to backup everything if only one file has changed, do you? (which also rsync handles)

Last edited by nx5000; 02-27-2006 at 07:21 AM.
 
Old 02-24-2006, 08:57 AM   #13
jerril
Member
 
Registered: Nov 2005
Location: Ontario, Canada
Distribution: Ubuntu
Posts: 114

Rep: Reputation: 15
Hi;

You might also want to check out Partimage:

http://www.partimage.org

jer
 
Old 02-24-2006, 09:15 AM   #14
RodWC
Member
 
Registered: Oct 2005
Distribution: Debian Etch i386, Lenny and Sid amd64
Posts: 177

Rep: Reputation: 30
I'm a traitor. I use Acronis. I'm thinking of using rsync though, once I get it all figured out. I'm sure that would be much faster than making a whole new disk image every time. The thing I worry about is restoration if my drive ever becomes completely wiped out. Will just copying the files (with cp or rsync) back onto a wiped disk, and then installing grub, make it bootable? I have my doubts. That's why I haven't done it yet!

leiavoia, it would be pretty cool if you would go ahead and post an example of the script you have created. BTW, does rsync delete files that are only in the destination? I'd like a util that does that.
 
Old 03-11-2009, 05:47 PM   #15
dajlinuxorg
LQ Newbie
 
Registered: Jun 2008
Location: Duluth, GA
Posts: 2

Rep: Reputation: 0
Acronis vs Rsync

Haha! I'm getting on the Acronis bus too. Just for the initial pre-patch imaging though. That was I will always have a quick backup of the OS to convert back to in the event of a disaster.

We are actually going to implement rsync as part of our DR solution and replicate between Production and the mirrored DR servers in a separate location. Hopefully it works.

I would love to see some existing scripts or related rsync tips or tricks that people are using. This is my first time attempting to use it, wish me luck!

Thnx in advance,

DJ
 
  


Reply

Tags
backup, imaging


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
Restored backup, now new root partition reporting wrong size. wackman Linux - Software 6 05-28-2005 03:24 AM
Root partition out of drivespace after backup fahrphrompuken Suse/Novell 1 12-14-2004 12:05 PM
root partition out of space after aborted yast2 backup fahrphrompuken Linux - Software 0 12-14-2004 11:26 AM
Why can't I restore a partition table backup containing a reiser partition? oldweasel Linux - Software 2 05-23-2004 01:11 AM
easiest way to know how much disk space is left on partition el jue Linux - Newbie 2 04-07-2004 10:19 PM


All times are GMT -5. The time now is 05:19 PM.

Main Menu
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