old-www/LDP/intro-linux/html/sect_09_03.html

307 lines
4.5 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML
><HEAD
><TITLE
>Using rsync</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="Introduction to Linux"
HREF="index.html"><LINK
REL="UP"
TITLE="Fundamental Backup Techniques"
HREF="chap_09.html"><LINK
REL="PREVIOUS"
TITLE="Moving your data to a backup device"
HREF="sect_09_02.html"><LINK
REL="NEXT"
TITLE="Encryption"
HREF="sect_09_04.html"></HEAD
><BODY
CLASS="sect1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Introduction to Linux: </TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="sect_09_02.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 9. Fundamental Backup Techniques</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="sect_09_04.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="sect_09_03"
></A
>9.3. Using rsync</H1
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="sect_09_03_01"
></A
>9.3.1. Introduction</H2
><P
>The <B
CLASS="command"
>rsync</B
> program is a fast and flexible tool for remote backup. It is common on UNIX and UNIX-like systems, easy to configure and use in scripts. While the <EM
>r</EM
> in <B
CLASS="command"
>rsync</B
> stands for <SPAN
CLASS="QUOTE"
>"remote"</SPAN
>, you do not need to take this all too literally. Your <SPAN
CLASS="QUOTE"
>"remote"</SPAN
> device might just as well be a USB storage device or another partition on your hard disk, you do not need to have two separated machines.</P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="sect_09_03_02"
></A
>9.3.2. An example: rsync to a USB storage device</H2
><P
>As discussed in <A
HREF="sect_03_01.html#sect_03_01_02_03"
>Section 3.1.2.3</A
>, we will first have to mount the device. Possibly, this should be done as <EM
>root</EM
>:</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;<TT
CLASS="prompt"
>root@theserver# </TT
><B
CLASS="command"
>mkdir <TT
CLASS="filename"
>/mnt/usbstore</TT
></B
>
<TT
CLASS="prompt"
>root@theserver# </TT
><B
CLASS="command"
>mount <TT
CLASS="option"
>-t vfat</TT
> <TT
CLASS="filename"
>/dev/sda1 /mnt/usbstore</TT
></B
>
</PRE
></FONT
></TD
></TR
></TABLE
><DIV
CLASS="note"
><P
></P
><TABLE
CLASS="note"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="../images/note.gif"
HSPACE="5"
ALT="Note"></TD
><TH
ALIGN="LEFT"
VALIGN="CENTER"
><B
>Userfriendly</B
></TH
></TR
><TR
><TD
>&nbsp;</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>More and more distributions give access to removable devices for non-prilileged users and mount USB devices, CD-ROMs and other removable devices automatically.</P
></TD
></TR
></TABLE
></DIV
><P
>Note that this guideline requires USB support to be installed on your system. See <A
HREF="http://www.linux-usb.org/USB-guide/"
TARGET="_top"
>the USB Guide</A
> for help if this does not work. Check with <B
CLASS="command"
>dmesg</B
> that <TT
CLASS="filename"
>/dev/sda1</TT
> is indeed the device to mount.</P
><P
>Then you can start the actual backup, for instance of the <TT
CLASS="filename"
>/home/karl</TT
> directory:</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;<TT
CLASS="prompt"
>karl@theserver:~&#62; </TT
><B
CLASS="command"
>rsync <TT
CLASS="option"
>-avz</TT
> <TT
CLASS="filename"
>/home/karl/ /mnt/usbstore</TT
></B
>
</PRE
></FONT
></TD
></TR
></TABLE
><P
>As usual, refer to the man pages for more.</P
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="sect_09_02.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="sect_09_04.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Moving your data to a backup device</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="chap_09.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Encryption</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>