Improved IT Habits

Improved IT habits are hard to live with and oh so important.  I have lost many important files over time and I have saved trivial files, no rhyme or reason.  I started to experiment with LAMP and a wiki server on my local laptop and lost it all due to an impetuous database delete command.  No backup, no wiki pages and of course the main purpose of the wiki pages was to provide online documentation.

https://help.ubuntu.com/community/BackupYourSystem

I want to work with a GUI so am starting with grsync.  First experiment worked well, I have an external USB drive and selected this as the destination.

Out of the box an external USB drive (e.g. thumbdrive) will be pre-formatted to be interchangeable with a Windows box.  This is good for sharing files between two systems and not so good for use as a Linux backup media.

tmike@tmike-HP-ENVY-m7-Notebook:/etc/apt$ df -h
Filesystem      Size    Used   Avail   Use%  Mounted on
/dev/sdb1        917G  54G    817G   7%      /media/tmike/LaptopBackup
/dev/sdc1         7.4G  4.3G    3.1G   59%    /media/tmike/Lexar
tmike@tmike-HP-ENVY-m7-Notebook:/etc/apt$ mount
/dev/sdb1 on /media/tmike/LaptopBackup type ext4 (rw,nosuid,nodev,relatime,stripe=8191,data=ordered,uhelper=udisks2)
/dev/sdc1 on /media/tmike/Lexar type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)

df shows mounted filesystems and mount provides more detailed information about each device.  In this example, /dev/sdb1 is a relatively large (1TB) external USB drvie and /dev/sdc1 is a relatively small (8GB) thumbdrive.  mount shows the filesystem on the thumbdrive to be vfat, which makes this device available for sharing files between a Linux box and a Windows box.  mount shows the filesystem on the USB drive to be ext4, which is a more appropriate choice for an accessible Linux backup medium.  Not only is ext4 more robust than vfat, since it is a native Linux filesystem type all of the important meta-data can be archived along with the file, e.g. owner/group information and file execution bits.  You want to use a robust native filesystem type for your backup medium.

Screenshot-grsync-basic-options Screenshot-grsync-advanced-options Screenshot-grsync-extra-options

For the test I am backing up (or rsyncing) /etc.

The three screenshots show the different options I selected.  As part of the test I synced the folders, made a trivial change to /etc/rc.local and re-synced the folders, confirming that only the single file was updated.  Note that since /etc is being synced, the superuser option has to be selected.

As I require additional directories to be synced I will create additional sessions, using these options as the template.

You will want to become familiar with GParted Partition Editor to help you manage the backup volume.  You probably have to install this tool with Ubuntu Software Center.  A couple of very important points need to be made about this tool.  This is a dangerous tool, a couple of button pushes (and answering the “Are you sure?” questions and you can destroy your desktop installation.  Treat it like you would a loaded gun, it is a tool so know how and when to use it.  In the top right corner is a drop-down list of the different mounted volumes the partition editor found when it started.  It will always choose or list the device with the root filesystem, when it starts.  If you don’t change this volume and apply some changes the changes are applied to the root filesystem.  dmesg is your friend, especially if you are using a USB thumb-drive.  Follow these basic steps to ensure the partition editor has selected the volume you want to work with:

  1. Start GParted Partition Editor
  2. Insert the USB device you want to use as your backup volume
  3. Type dmesg in a command-shell and see what device the system has just been made aware of (e.g. sdb: sdb1)
  4. Use the drop-down list selector and choose this device (e.g. /dev/sdb)

At this point the partition editor has the correct volume selected and  you can create/delete partitions as well as format the device for a specific filesystem.  In this screenshot notice that the device is /dev/sdb and the partition is /dev/sdb1.  If you find  that you can’t apply operations to the selected volume, it may be that the volume has to be unmounted.