Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,800
Rep:
Re: recommended backup solution?
Quote:
Originally posted by doublefailure my harddisk got currupted and i ended up buying new computer
it is very painful lesson.
Ouch! What happened t the old computer?
Quote:
i'm thinking of having additional hd and find some backup software to regularly backup from hd1 to hd2..
Well if you're just going to install a second disk, you could partition it just as you did your primary drive and duplicate the filesystems on a nightly basis using something as simple (and free!) as tar or cpio. Check out the info page for cpio, especially the section on copying directory structures. Essentially you'd do:
cd fs_mnt_pt ; tar clf - . | ( cd /mnt/dup_fs_mnt_pt ; tar xf - )
to copy a directory structure as well. (I'm sure someone will spot a switch I forgot... :-) )
Backup strategies need to take into account the risk you're trying to reduce and why you might lose it: user error, hardware failure, etc. . For example, having your backup physically installed in the system you're trying to protect won't be much protection for losing data if there's a power surge that damages the system. Plus, using an internal drive as your backup medium won't help much if you realize that you screwed up a file yesterday and last night's backup just made a perfect copy of the corrupted file onto your secondary drive. Unless you want to shut down on a daily basis to install a new hard disk so you have a rotation of disks used for backups.
Is tape out of the question? It's not as fast as a disk-to-disk backup but if you can fit everything you need to backup onto a single tape, it's something you can kick off at the end of the day and remove the following morning. It can cost a bit up front (for hardware and a bit of media) to start backing up to tape. But so can lost data.
Distribution: RH 6.2, Gen2, Knoppix,arch, bodhi, studio, suse, mint
Posts: 3,304
Rep:
if the second hard drive is at least as big as the first,
you can
dd if=/dev/hda of=/dev/hdb
that will copy the drive
it will go much faster if you add bs=1M
to that line.
you can back up individual partitions with
cat /dev/hda1 | gzip > /mnt/wherever
then restore with
gzip -cd filename.tgz > /dev/hda1
you can make the free space on a partition more
compressible by
dd if=/dev/zero of=full,
then deleting the file when it fills up the free space on
the partition, then dd'ing.
you'll have to jump
another hoop if you want files
bigger than 2 gigs
copying a 40 gig drive on my machine with dd
takes about 35 minutes.
you can dd if=/dev/hda of=/dev/hdb bs=1M; poweroff
to have your machine shutdown when it's done copying.
copying all the files with tar or cp takes much longer
unless the drive is mostly empty.
If you're going to back up frequently, the most cost-effective solution would be CD-RW's. The media are dirt-cheap compared with other solutions, and there's no risk of accidentally corrupting your data like you would have with a second hard drive (as long as it's good when you put it on there, of course). Just set cron to back up the appropriate directories once a week, with a prompt before it starts so you can make sure the correct disc is mounted in the drive.
You can reuse a quality CD-RW more than 10,000 times, so even one will last you for about 200 years of weekly backups. And, of course, you can use the drive for reading CDs and for CD-R burning as well.
With cron, twice a week, I save important, changed files to a partition on a 2nd hard drive, using similar to following:
/bin/tar --use-compress-program bzip2 -cvf $FILE $(SHOW)
where the "SHOW" script is similar to following:
find "HOMEDIRECTORY" -type f -mtime -30 |egrep -v '\.gz|\.tgz|\~$|\.swp|core$|core\.|\.gif$|\.jpg$|\.zip$|\.ZIP'
The egrep excludes "unworthy" larger files.
Every month/6-weeks, I save to CDR.
Also suggest rpm -qa>rpmfile and save rpmfile
A bit hairy, but reduces manual steps and has saved me.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.