Backup of Data on a NetBook

Take a backup of data on a NetBook remotely via a local network by using an open source version control system Subversion (SVN)

Idea: Virtualization Software + Linux + Subversion

How-To:

  1. Install virtualization software on your main computer, e.g.,
  2. Set a virtual machine up on the virtualization software.
  3. Install Linux on the virtual machine with a Linux distribution such as CentOS.

Instructions for installing VirtualBox (for Windows), CentOS and Subversion

  1. Install VirtualBox
    1. Download an installer "VirtualBox for Windows hosts" (latest version 3.1.2 build 56127 as of 12/28/2009) from http://www.virtualbox.org/wiki/Downloads.
    2. Launch the downloaded installer "VirtualBox-3.1.2-56127-Win.exe".
    3. When "Sun VirtualBox License Agreement" is displayed, select "I accept the terms in the License Agreement".
    4. Choose the default for all inquiries.
    5. Once the installation is finished, VirtualBox is launched.
    6. Go to File > Preferences menu in order to customize settings of VirtualBox.
  2. Download an ISO image (latest version 5.4 as of 1/01/2010) from the CentOS (Community ENTerprise Operating System) Web Site
  3. Prepare a virtual machine of VirtualBox for installation of CentOS
    1. Launch VirtualBox
    2. Choose File > Virtual Media Manager menu
    3. Create a virtual hard disk (VHD) in the "Hard Disks" tab and name the VHD appropriately, e.g., CentOS.vdi
    4. Add the downloaded CentOS installer image in the "CD/DVD Images" tab
    5. Click the "OK" button of Virtual Media Manager
    6. Choose Virtual Machine > New menu
    7. Virtual Machine Wizzard starts
    8. Specify the following for the virtual machine
      • Name: CentOS
      • OS: Linux
      • Version: Red Hat
    9. Specify an appropriate memory size such as 512Mbyte
    10. Select "Existing Hard Disk" and select CentOS.vdi
    11. Review the settings and finish → The created virtual machine appears in the left upper corner
    12. Click the created virtual machine "CentOS"
    13. Choose Virtual Machine > New menu
    14. Select "Storage" in the left part of a dialog
    15. Click a CD icon and choose the downloaded centOS installer image for the "CD/DVD Devices" attribute
    16. In the dialog, specify "Network" and selct "Bridge Adapter" in the "Allocation"
    17. Click "OK"
  4. Install CentOS on the virtual machine
    1. Click the virtual machine "CentOS" created above
    2. Boot the virtual machine by choosing Virtual Machine > Start menu
    3. Once the boot screen of CentOS installation is displayed, proceed a typical procedure of the CentOS installtion (Refer to a tutorial or instructions on installation of CentOS)
      Remark: Allocate a static IP address (e.g., 192.168.0.100) to the virtual machine because it is used as a server for backup repository.
  5. Install Subversion on the virtual machine
    1. Boot CentOS on the virtual machine
    2. Synchronize its system clock with an NTP server
        # service ntpd stop
        # ntpdate time.nist.gov
        # service ntpd start
      
    3. Apply security updates
        # yum -y update
      
    4. Install Subversion
        # yum -y install Subversion
      
    5. Install the mod_dav_svn module of Apache for access to Subversion repository via an Apache HTTP server
        # yum -y install mod_dav_svn
      
    6. Create Subversion repository
        # mkdir /var/www/svn
        # svnadmin create /var/www/svn/workspace
        # chown -R apache:apache /var/www/svn
      
    7. Set Apache's password protection for a user (say, svnuser) to access the repository
        # htpasswd -c /etc/httpd/.svnpasswd svnuser
        New password:
        Re-type new password:
        Adding password for user svnuser
      
    8. Backup the original configuration files of Apache and Subversion module
        # cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.original
        # cp /etc/httpd/conf.d/subversion.conf /etc/httpd/conf.d/subversion.conf.original
      
    9. Edit the Apache's configuration file /etc/httpd/conf/httpd.conf, e.g.,
        # ServerName www.example.com:80
        ServerName svn:80
      
      Regarding customization of the configuration file, refer to a tutorial or documentation of Apache.
    10. Edit the Subversion module's configuration file /etc/httpd/conf.d/subversion.conf, e.g.,
        LoadModule dav_svn_module     modules/mod_dav_svn.so
        LoadModule authz_svn_module   modules/mod_authz_svn.so
        
          DAV svn
          SVNParentPath /var/www/svn
          AuthType Basic
          AuthName "Authorization Realm"
          AuthUserFile /etc/httpd/.svnpasswd
          Require valid-user
        
      
    11. Double check the syntax of the edited configuration files by using the Apache command configtest
        # service httpd configtest
        Syntax OK
      
    12. Start the Apache HTTP server
        # service httpd start
      
    13. Confirm whether the Subversion repository can be accessed via the HTTP server
        # svn checkout http://192.168.0.100/repos/workspace --username svnuser
        Authorization Realm:  Authorization Realm
        'svnuser' password:
        Checked out revision 0.
        # cd workspace
        # echo "hello" > hello.txt
        # svn add hello.txt
        A         hello.txt
        # svn commit -m "added hello.txt"
        Sending    hello.txt
        Transmitting file data
        Committed revision 1.
      
    14. If the Subversion repository is working OK, enable automatic start of the HTTP server
        # chkconfig httpd on
      
      Now, the Subversion repository is ready.
  6. Install a Subversion client on a NetBook, e.g.,

How to Use SVN for Backup

In case of using TortoiseSVN as a client on Windows:
  1. Open Windows Explorer
  2. Right-click on the "My Document" folder to show a menu
  3. Select "SVN Checkout" in the menu
  4. Input the SVN repository's URL http://192.168.0.100/repos/workspace/
  5. When authentication is requested, type the user's name and password that are specified in the above installation of Apache and Subversion
  6. When "Committed revision 1" is displayed, everything is OK
Once checkout is successfully done, the workspace folder has been created in the "My Document" folder. Now, you have a mechanism for synchronizing the Subversion repository on CentOS and the workspace folder in the "My Document" folder on the remote client machine. You can synchronize data among multiple machines by putting data into the workspace folder and committing on TortoiseSVN. If there is a conflict on updating data by multiple clients, Subversion warns the conflict and prevents the inconsistent update.

Since Subversion maintains not only the latest data, but also older "revisions" of data, it can resolve a trouble in an accidental overwrite of data.

Example: Addition of a File

  1. When a new file is created in the workspace folder, a question mark "?" will be shown on the new file
  2. Open "My Document" on Windows Explorer
  3. Right-click the workspace folder and select "SVN Update"
  4. Right-click the workspace folder and select "SVN Commit"
  5. Describe the file addition in "Message" and check the newly added file
  6. Click OK
  7. When "Committed revision" is displayed, backup is complete

Example: Modification of a File

  1. When a file in the workspace folder is modified, a punctuation mark "!" will be shown on the modified file
  2. Open "My Document" on Windows Explorer
  3. Right-click the workspace folder and select "SVN Update"
  4. Right-click the workspace folder and select "SVN Commit"
  5. Describe the file modification in "Message" and check the modified file
  6. Click OK
  7. When "Committed revision" is displayed, backup is complete

Example: Deletion of a File

  1. When a file in the workspace folder is deleted, a punctuation mark "!" will be shown on the deleted file
  2. Open "My Document" on Windows Explorer
  3. Right-click the workspace folder and select "SVN Commit"
  4. Describe the file deletion in "Message" and check the deleted file
  5. Click OK
  6. When "Committed revision" is displayed, backup is complete
If a file is shown with a punctuation mark "!" and its deletion was a mistake, right-click the workspace folder and select "SVN Update". Then, the deleted file is restored from the Subversion repository.