LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Backing up to external HDD? (https://www.linuxquestions.org/questions/linux-newbie-8/backing-up-to-external-hdd-223254/)

dgermann 08-27-2004 05:32 PM

Backing up to external HDD?
 
Hi--

Let's say I'd like to do my backups to a removable HDD, and keep the copy as quick and easy to restore as possible.

(I just went through trying to restore one directory from a mamoth .tgz file, and it has been very slow, indeed. So I think I want to have files that are unarchived and unzipped. Just copy and go. If that does not make sense, please tell me why.)

So what commands or programs would I best use, keeping in mind that I want to keep intact all ownerships and permissions on all files? What are the exact commands to use, keeping in mind I am still wet behind the ears on linux.

Would I use dd? cpio? afio? a disk image program like http://www.partimage.org/ ?

ToniT 08-27-2004 05:56 PM

I would use tar.

eg.
Code:

tar c /foo | tar Cvx /backup/of/

bruno buys 08-27-2004 07:33 PM

That's interesting... I have myself tried a bunch of backup techniques. One which is very interesting, if you wanna have fast access to data is to make an iso file. Then you can mount the iso file to any dir and access data (mount -o loop /iso-to-be-mounted /mountpoint). This way you can have all data in only one file. Just like a huge targz. But to my experience, access to an iso file is faster than targz when it comes to >1GB files.

If you have enough room, just copy dirs raw. Do some research on the "synchronize" features some file managers have. Krusader can synchronize, I guess. Using a sync program you can mirror entire dir threes in a blink.

And: Partimage can be used from a System Rescue CD, which is very good and a small iso download (~100MB). Google for it.

dgermann 08-27-2004 08:17 PM

ToniT--

Thanks. The tar for me turned out to be a lot of work and time for restores. Plus, I hear they are a potential problem in that if one part of the archive is bad, it can prevent access to uncorrupted parts.

So that's why it seems to me that backups via some straight copy technique is a good idea.

Why do you like the idea of tar instead?

bruno buys--

Thanks for the multiple ideas.

Let me see if I understand:

First, I am not sure how to make an iso file. Is that what Partimage does? It talks about making an image of a partition, but I don't know if that includes the data in the partition....

Second, I don't know what you mean by "synchronize features." Is there an app that does that?

Third, what is Krusader? I do not find it on my drive using locate.

Finally, I have heard of system rescue CDs. My idea of that would be a disk that takes an image of the whole drive and then when something goes kaflooey, you just wipe the drive and restore the image to its pristeen condition before the problem. Right? Anywhere close?

I like the idea of a raw copy as you suggest. I used cpio to transfer stuff to my second internal HDD when I installed it, and to a removable hard drive, and so far as I can tell all permissions and ownerships went along with it....

Thank you both for your help. I really needed to hear from you.

bruno buys 08-27-2004 09:30 PM

Hi friend!
*****
First, I am not sure how to make an iso file. Is that what Partimage does? It talks about making an image of a partition, but I don't know if that includes the data in the partition....

Partimage uses mkisofs to make an iso image of the partition (including data on it). You can use mkisofs yourself at the cli. mkisofs is quite standard in every distro and its very easy to use. Just "rpm -q mkisofs" to see if you have it.
*********

Second, I don't know what you mean by "synchronize features." Is there an app that does that?

To synchronize dirs is to pick any two dirs (you choose) and make them clones of each other. Its just copying files and sub-dirs, but you don't have to do manually. A sync-enabled program will check for the existence of the file and copy if necessary, as well as sub-dirs and also check for the newest ones. In the end, you have two identical dirs. Its very good for backing up.

The winSCP3 ssh client for win can sync a remote linux host. Very nice, I use it a lot at work to sync with my linux computer at home.

In win, there's total commander, former windows commander. Syncs nicely.
*********
Third, what is Krusader? I do not find it on my drive using locate.

Krusader isn't default. Here you can see it: http://krusader.sourceforge.net/
*******

Finally, I have heard of system rescue CDs. My idea of that would be a disk that takes an image of the whole drive and then when something goes kaflooey, you just wipe the drive and restore the image to its pristeen condition before the problem. Right? Anywhere close?

Right. If done correctly, you can backup a partition with a boot sector, and restore it perfectly.
Sysresccd is actually, a linux distro, aimed at maintenance. The guys are very good. Sysresc rocks, at making partitions, running fsck against damaged filesystem and stuff. Its got even qtparted, a GNU partitioner! The point is, you don't have to install anything or edit your system. sysresc is bootable and lots easier to run than to cope with deps, install things, unmount devices, build backups, etc...
http://www.sysresccd.org

Obs - Also, sysresc can burn the image file to a cdr(w) drive.
*******
I like the idea of a raw copy as you suggest. I used cpio to transfer stuff to my second internal HDD when I installed it, and to a removable hard drive, and so far as I can tell all permissions and ownerships went along with it....

I'm not sure if it failed due to some cpio internals, or filesystem problem. The filesystem you backed up to was fat, by any chance? fat systems can't hold file permissions.

To do this you can use the dd command, which is to me, one of the commands worthy to know detailed operation. dd is great. With dd you can do

dd if=/dev/hda1 of=/my-backup-place

where "if" means input file and "of" is output file.

also, dd can copy an entire floppy to an image file by doing

dd if=/dev/fd0 of=/dev/hdaX/somedir/somefile
******

I went sort of wild, backing up things here, after my seagate crashed badly. Now I got five backup partitions and a script that builds a mamoth tgz (like you say) and saves five copies of it in diff partitions. No surprises, anymore.

Post again if you wish. If you find something new about backing up, please let me know!

********

ToniT 08-27-2004 09:48 PM

I have been misinterpreted here...

If you read closely enough, you see I wasn't using tar to make tar.gz packages, but to copy files from one location to an other by piping all the data through. Why copy files with tar? It keeps all the date and attribute information and it is network transparent (can be used together with netcat or ssh). Nice alternative to cp, cpio, dd and friends.

dgermann 08-27-2004 10:31 PM

bruno buys--

Yup, I did a locate and found /usr/bin/mkisofs. So I could learn something about it and see. Does it save to a regular file or to a CD? The man file looks a little intimidating.

<<You can use mkisofs yourself at the cli

What's a cli?

As far as mammoth .tgz files, I think I am done. I have broken my script file for the cron job down to make two separate backups (as .tgz), one of the system stuff, and a second of the data. May just break the system stuff down into a couple different files, too, to keep them small. Lightweight is easier to search and restore. And not all my eggs in one basket....

Thanks, bruno buys!

ToniT--

Ahh, I see that now! Sorry to have misquoted you.

Why do you like tar over cpio, for example, or dd?

bruno buys 08-27-2004 11:19 PM

*******
So I could learn something about it and see. Does it save to a regular file or to a CD?

It saves to a file. If you wanna burn it, you can burn as an image, and have all file system under it completely kept.

You can also mount the file into a dir of your choice. If you want to see how it works, do this:

Pick one .iso file like a linux distro, anyone would do. Then mount it:

mount -o loop linux.iso /home/dgermann/mountiso/

This will give you access to the dirs and files inside the iso, see? Its read-only, though.
Someone started a thread asking how to mount them read-write, but i dont know if he succeeded.

This way you can keep backup files of your data, access them and burn cd's. You can remove old ones and build new ones, but you can't (to my knowledge) edit these files.
**********

What's a cli?

Sorry friend. This is lingo for a Command-Line-Interface, as opposing to a Guided-User-Interface. Its the console.

********

As far as mammoth .tgz files, I think I am done. I have broken my script file for the cron job down to make two separate backups (as .tgz), one of the system stuff, and a second of the data. May just break the system stuff down into a couple different files, too, to keep them small. Lightweight is easier to search and restore. And not all my eggs in one basket....

Yes, indeed. As far as linux is concerned, its got several tools for backup already as standard available. This is very good. You can make an iso file and save it to a few diff partitions, for example.

If you have a removable device, its great for backup. I have two ide disks, so I write my files to both.

Anyway, take a look at sysresc. It might give you another good ideas about all this.



*********

dgermann 08-28-2004 11:06 AM

bruno buys--

Wonderful help you are giving me bruno buys! Thank you!

It occurs to me that some of my frustration is coming from the wealth of ways to do something in linux--tar, cpio, dd, afio, .iso, sysresc, for example--and choosing among them is like deciding from 39 ice cream flavors. I need to remember that I can come back to the ice cream stand again later.

Then again, I could have one scoop of cpio and one of .iso both in the same cone (cron job), and have double protection....

Thanks for the great tutorial and hand-holding, bruno buys!

bruno buys 08-28-2004 12:19 PM

Glad I could help! Cheers, Doug!

One last thing: In my kde, there's a menu Sync, under Utilities. Its got some synchronizing tools for mobiles, palms, and laptops. This KFS thing is supposed to sync websites, but I guess it can be used for dirs.

dgermann 08-30-2004 11:10 AM

Thanks, bruno buys!

You are a real help!


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