Solved

How to do backup and restore with rsync on linux?

Posted on 2010-09-14
6
742 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
unable to put logic for reading multiple repo in a single file 4 106
AWS EC2 HTTP & HTTPS 2 119
Bash script to include windows servers 13 41
Bitcoin mining - Is it possible? 6 104
I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
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…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

752 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