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
Solved

How to do backup and restore with rsync on linux?

Posted on 2010-09-14
6
738 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
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
Fine Tune your automatic Updates for Ubuntu / Debian
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…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

856 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