?
Solved

How to do backup and restore with rsync on linux?

Posted on 2010-09-14
6
Medium Priority
?
769 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 160 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 80 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 1480 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
How Blockchain Is Impacting Every Industry

Blockchain expert Alex Tapscott talks to Acronis VP Frank Jablonski about this revolutionary technology and how it's making inroads into other industries and facets of everyday life.

 
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 80 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

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
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…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses

718 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