Solved

How to do backup and restore with rsync on linux?

Posted on 2010-09-14
6
728 Views
Last Modified: 2012-05-10
I got a linux machine running SLES9 with rsync available.  
I would like to back up the whole system in 2 or 3 steps using rsync
to an exernal usb 2TB drive which has been formatted to FAT32.
(I know, it is not the best practice to have big drive like that
in FAT32, but I'm not too good in linux.)  

How do I run rsync to back up the system with minimum files and
restore the system?  I assume it is possible when I mess up the machine,
I can restore the system from a different machine with backup drive
(external usb 2TB) and a SATA hard drive.  

The display of df command is below.
linux2:/tmp # df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda3             30969600  28556508    839928  98% /
tmpfs                  2024720        12   2024708   1% /dev/shm
/dev/sda1               101105     11301     84583  12% /boot
/dev/sda7             53028292  49499092    835504  99% /home
/dev/sda6             20641788  14549688   5043460  75% /opt
/dev/sda5              5162828   2759284   2141284  57% /var
/dev/sdb1            961195208 857966920  54402340  95% /data
/dev/sdc1            1953035168        32 1953035136   1% /mnt/usbdrive
inux2:/tmp #

Additional info:
1. /mnt/usbdrive is the 2TB external usb drive.
2. /data is another hard drive which only has data files. (I think rsync command
   and handle this drive separately.)
3. OS has a RAID1 setting.

Any opinion is very much appreciated.
0
Comment
Question by:asugri
6 Comments
 
LVL 6

Assisted Solution

by:DalHorinek
DalHorinek earned 40 total points
ID: 33675746
There's gonna be a problem with rights restoring, because FAT32 can't handle linux fs rights.

If you want to do a full backup with rsync, just run rsync -avz /specify /directories/witch /you/want /to/backup /mnt/usbdrive/

And these directories will be backed up.

You should backup
/boot
/etc
/opt
/home
/var

But you won't be able with this restore whole disk, you would need new installation and than copy files back.

Would be better to do a full backup with booting live cd and do image of hard drive. Or rsync whole / but anyway without privileges it won't help you much.
0
 
LVL 7

Assisted Solution

by:rumi78
rumi78 earned 20 total points
ID: 33675797
Hi asurgi,

The question is what do you want to backup.
1. You can backup/restore the whole partitions on your FAT32 drive. And you will have just partitions stored as big files on memory stick. But it must be done on not mounted file systems (e.g. booted from cd). Backuping process wil take very long time.
2. You can use rsync, but I strongly recommend to format usb drive to linux compatible file system (e.g. ext3, ext4) otherwise file permissions will be lost. So during restoring you will have to assign proper rights to files by yourself.
The only disadvantage is you will not be able to see files on usb drive on pure windows (additional software will be required)
Together with dirvish you can have incremental backup (e.g. once a day) so you will be able to restore files to selected day (not only last backup version)

Please select solution.

rgds
rumi

0
 
LVL 12

Accepted Solution

by:
mccracky earned 370 total points
ID: 33675881
If it's the first time copying, cp is probably slightly faster than rsync.  Only when you already have some of the files on the backup is rsync faster.  First, reformat the external drive to something like ext3. (mkfs.ext3 /dev/sdc1)

Regarding the minimal amount of files, if you want a full backup to restore including the system, you need all the files.  If you just want the data and settings, you really only need /home and /etc/ backed up.

Check this link:
http://ubuntuforums.org/showthread.php?t=35087
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 12

Expert Comment

by:mccracky
ID: 33675902
If you do the tar (rather than rsync) as the link I posted above suggests, you can still have all the linux rights even if you store the actual tar file on a FAT32 or NTFS drive.  If you want to use rsync, to keep the rights, you can't use FAT or NTFS.
0
 
LVL 1

Assisted Solution

by:mmagdy_mickey
mmagdy_mickey earned 20 total points
ID: 33676018
i think rsync is so easier than tar as tar used to take a full backup every time but rsync used to take only the difference between two backups so less load and faster you can use  :  man rsync it is so helpfull
0
 

Author Comment

by:asugri
ID: 33686399
Thanks a lot for all the postings.   I used tar to back up after converting FAT32 to ext3 this time.  I'll try
rsync in the future.

0

Featured Post

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

This is the error message I got (CODE) Error caused by incompatible libmp3lame 3.98-2 with ffmpeg I've googled this error message and found out sometimes it attaches this note "can be treated with downgrade libmp3lame to version 3.97 or 3.98" …
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now