rsync is bad...now fixed

Karl Larsen k5di at zianet.com
Mon Jun 9 01:37:01 UTC 2008


Les Mikesell wrote:
> Res wrote:
>   
>> On Sun, 8 Jun 2008, Karl Larsen wrote:
>>
>>     
>>>    Hi Les, this message is from my Ubuntu that was just backed up with
>>> rsync. 
	Here is what I have been doing. I have almost finished my work. It sure looks good.


                Using rsync to back up your own computer

        I had problems with the backup I made with rsync. When I copied the current Ubuntu 7.10 from the computer to the USB hard drive, and then back to the computer in a different partition (/dev/hda7) the system would not boot clear up. It had a problem with GTK+ which was due to a root /tmp. I was experimenting and had a whole lot of failures. But I learned a lot as well.
The one that caused trouble looked like this:

 karl at karl-desktop:~$ cat /root/bin/backup 
# This file is designed to backup my Ubuntu to the USB Hard Drive using rsync 
# Karl Larsen, 26 Feb 08
rsync -av /boot /media/disk/
rsync -av /bin  /media/disk/
rsync -av /dev  /media/disk/
rsync -av /etc  /media/disk/
rsync -av /lib  /media/disk/
rsync -av /opt  /media/disk/
rsync -av /root /media/disk/
rsync -av /sbin /media/disk/
rsync -av /tmp /media/disk/
rsync -av /usr /media/disk/
rsync -av /var /media/disk/
rsync -av /initrd /media/disk/

        I really can't say the above did not work, but it is not a good way of doing things.

        The repaired one I am now using looks like this:
karl at karl-desktop:~$ cat /root/bin/rsync-mnt 
# This file is designed to backup my Ubuntu to the USB Hard Drive using rsync 
# Karl Larsen, 8 june 08
# rsync -vaHz --exclude '/proc' --exclude '/sys' --exclude '/media' /.
# /media/disk
# This is what works on my computer
rsync -vaH --exclude '/proc' --exclude 'sys' --exclude 'home' --exclude '/mnt' --exclude '/media' /. /mnt

Both of these are in bash files I call as root so they can get to all directories. This last one works just great! I am typing this on an rsync third copy of the system and a second copy of /home/karl/!

        You need to make the copy, about 15 minutes,  and then while it is still mounted at /mnt look at the directories the copy made and get ready to make new directories for /home and /proc and /media and /mnt and /sys. when you get done with $ sudo mkdir home then your ready to fix the information in your /etc/fstab and /boot/grub/menu.lst files.

        To get the proper uuid for the new location you need to know the partition your using and say for instance it is /dev/sda2. You need the uuid for that partition and you get it with $sudo vol_id  /dev/sda2 and this will generate quite a pile:

 karl at karl-desktop:~$ sudo vol_id /dev/sda2
[sudo] password for karl:
ID_FS_USAGE=other
ID_FS_TYPE=swap
ID_FS_VERSION=2
ID_FS_UUID=4d7c4159-d00c-4069-bfb6-f9a6e153c723
ID_FS_UUID_ENC=4d7c4159-d00c-4069-bfb6-f9a6e153c723
ID_FS_LABEL=
ID_FS_LABEL_ENC=
ID_FS_LABEL_SAFE=

The one you want is the 4th down. This is what you will use to change the old one to the new location.

        Now go to /mnt/etc and then sudo gedit fstab. This will show you the whole file which might look like my small one:

# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
# /dev/sda2
UUID=95429e4c-cdde-480a-88ba-674fb6619838 /               ext3    defaults,erro
# /dev/hda1
UUID=7915f630-518c-425b-9fea-0ef07e50d0f9 none            swap    sw
# /dev/hda2
UUID=4d7c4159-d00c-4069-bfb6-f9a6e153c723 none            swap    sw  
/dev/hdb        /media/cdrom0   udf,iso9660 user,noauto,exec 0       0
/dev/sda5             /home       ext3     defaults       1    2

After fixing your /etc/fstab file go to your /boot/grub/menu.lst file and use the uuid in fstab in menu.lst. They need to be identical!

        Now try out the copy. I put the copy in the grub I am using as the original. That way you can come back up in the orginal if the copy fails. I will not show the things you need to do to grub since this is about rsync.

Karl




-- 

	Karl F. Larsen, AKA K5DI
	Linux User
	#450462   http://counter.li.org.
   PGP 4208 4D6E 595F 22B9 FF1C  ECB6 4A3C 2C54 FE23 53A7





More information about the ubuntu-users mailing list