backup and restore using tar
I would like to know your thoghts on this. I am trying to find the best means to backup my entire Web Server to tape on a nightly basis. I feel that tar might be the way to go as I am not quite qualified to write backup scripts yet. Does tar maintain file permissions in the event that a restore is required? I don't want to loose all my file permissions and group ownerships.
How would I create a script using tar to backup the entire Mandrake 9.1 system and where should I store this script so root can perform this?
I will be backing up to /dev/st0
Your thoughts on this are very much welcome.
The way to backuop anytthing keeping the permisions woulld be:
tar cvpf /dev/st0 <whate_ever_path>, now, if you plan to backup on a daily basis y would suggest to put via cron:
00 23 * * * tar cvpf /dev/st0 /etc/httpd /var/www
this will allow you to backup automatically at 11pm everyday.
If you want to backup an entire system, I wond use another disk ass mirror and would type
dd if=<disk_device> bs=1024 of=<your_mirror_disk_device>
or you can send it to tape:
tar cvpf /dev/st0 / /etc /usr /var /tmp /opt /sbin (it depends how did you create your partitions and how big they are)
here is my disk structure.
Filesystem Size Used Avail Use% Mounted on
/dev/hda5 3.9G 1.8G 2.0G 49% /
/dev/hda1 46M 8.7M 35M 20% /boot
/dev/hda6 9.7G 49M 9.7G 1% /home
/dev/hda7 3.8G 422M 3.2G 12% /var
/dev/hdb1 19G 781M 17G 5% /var/www
I wish I could mirror but I dont see how with the way the system is configured.
ok here is I would do the backup using tar with bz2 compression
use a dds-3 tape (12gb/24Gb capacity)
tar -cjvjpf /dev/st0 / /boot /etc /home /var /www
the way to recover from tape the entire system would be:
tar xvjpf /dev/st0
thank you.. I am testing the tar backup on one of my test systems. Until I get more familier with Linux I think I will stay with tar..
I see that you use tar cvpf
Is it the p attribute that preserves the permissions?
This is an excerpt from the tar man page
tar -czvfp /hd1.tar * --exclude-from backup-x
In the same directory that my backup script is located, I placed another file called backup-x which contains a list of files and directories that should be excluded from the backup process. I placed all of my large application installation files into a folder called apps and excluded the contents because I do not want to back up those large files every night when they do not change from day to day.
I also found that my script ran into a file called libnss_ldap-2.3.1.so that stopped the script and had an overrun loop that required me to hard reboot my server. That was before I used the 'p' attribute so it might have been a permissions issue (not allowing tar to copy the ldap file and edit permissions for security reasons probably).
I excluded the libnss_ldap-2.3.1.so file in the backup-x file. Do you think that will be a fatal mistake if and when have to do a restore?
Other exclusions included the name of the .tar files resulting from the backup, otherwise you end up backing up your backups, which is a major waste of space and might result in a never-ending loop.
One other thing...I forgot to use the standard suffix for my tar file which should have been .tgz since I was tarring and gzipping within one command. For a quick summary on tar and gzip see Redhat.com compression
What is st0 that you use in your example?
I see it in the /dev/ where there are 128 st# items stored. If I try to open it in pick or vi, it says it is not a file. Is this kernel base or something?
I boot a knoppix cd and run Partimage. I can image a 15gb partition to my 2nd hard drive easily. If I am only using 6gb's of that 15, the partition image will reflect that instead of needing 15gb's for the image. I do it with tar.gz, so the image is even smaller, say; 4gb's. There is ways to run Partimage with a script, but the partition you want to image can't be mounted. If you dual-boot different distro's you could do it from one, or it can even be done over a network if you have another machine.
|All times are GMT -5. The time now is 04:48 PM.|