• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 893
  • Last Modified:

How to do backup and restore with rsync on linux?

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
asugri
Asked:
asugri
4 Solutions
 
DalHorinekCommented:
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
 
rumi78Commented:
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
 
mccrackyCommented:
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
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
mccrackyCommented:
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
 
mmagdy_mickeyCommented:
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
 
asugriAuthor Commented:
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

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now