Backing Up a Hard Drive with FSArchiver

A few years ago, I had the opportunity to learn and practice how to backup hard drives and restore copies onto other machines with identical settings. We had purchased a bunch of laptops and imaging solutions weren’t as developed or allowed in my environment (required a server). 


In this blog entry, I document the use of FSArchiver, a free utility on the GParted (Linux) media to backup a hard drive for a work colleague.

FSArchiver is a system tool that allows you to save the contents of a file-system to a compressed archive file. The file-system can be restored on a partition which has a different size and it can be restored on a different file-system.…FSArchiver also creates the file-system when it extracts the data to partitions. Everything is checksummed in the archive in order to protect the data. If a file is corrupt, you just lose the current file, not the whole archive. 

Some of the features that jump out at me include the following:
  • Ability to restore the filesystem to a partition which is smaller than the original
  • Ability to restore the filesystem to a partition which is bigger than the original
  • Ability to do multi-threaded compression which is faster on recent computer with multiple cores/cpu
  • Ability to encrypt the data with a password

Item #2 was relevant, since I was restoring from an 80gig hard drive to a 180gig hard drive, a drive much bigger than the original.

The process I followed appears below:


1) Get Everything Ready. To get started, I booted the computer using my GParted USB Flash Drive, which I created using UNETBOOTIN. 


2) Prepare the USB external drive to receive the backup file. To prepare the external USB drive, formatted a USB External drive to the ext3 file system (as opposed to FAT32) to use as my backup drive with this command:

mkfs.ext3 /dev/sdd1

After formatting the drive, I unplugged it then plugged it back in.

3) Mount the USB External Drive. First, I created a directory at “/mnt/backup” using this command:

mkdir /mnt/backup

To find out what was the actual locations (e.g. /dev/sda1 or /dev/sdc1) of the drives, I typed in the following command:

fdisk -l

This revealed that /dev/sda1 was my computer’s hard drive, while the external USB drive I was backing up to was /dev/sdd1 . Another way to accomplish this is to type the following command:

fsarchiver probe simple

This would give you a list of drives (e.g. sda1, sda2, etc.).

With this information, I mounted the external drive (/dev/sdd1) as “/mnt/backup” using this command:

mount -t ext3 /dev/sdd1 /mnt/backup

I changed to that directory with this command:

cd /mnt/backup

4) Begin the Backup Process with FSArchiver. I began the backup process using FSArchiver by typing (note that /dev/sda1 is the location of the hard drive partition I want to backup)

fsarchiver savefs /mnt/backup/hddbackup.fsa /dev/sda1

Here is the report FSArchiver gave me at the end of its process:

Statistics for filesystem 0* files successfully processed:….regfiles=37329, directories=4308,symlinks=2,hardlinks=3,specials=0*files with errors:…………………..regfiles=0, directories=0, symlinks=0, hardlinks=0, specials=0

When the backup process was completed, I restored the backup using the command below:

fsarchiver restfs /mnt/backup/netbook.fsa id=0,dest=/dev/sda2


Here is the report I received from FSArchiver when it was done:

Statistics for filesystem 0* files successfully processed:….regfiles=37329, directories=4308, symlinks=2, hardlinks=3, specials=0*files with errors: regfiles=0, directories=0, symlinks=0,hardlinks=0,specials=0

5) Unmount your external USB drive safely and exit. You can quickly unmount your external USB drive–as opposed to just turning everything off or unplugging it without warning, which can be problematic to data integrity–by typing the following at the command line:

umount -a


Then to exit, just type the following command and shutdown your computer:

exit



And, fortunately, that was all there was to it! If you’re curious about more options, you can read this older blog entry or FSArchiver.org.


Everything posted on Miguel Guhlin’s blogs/wikis are his personal opinion and do not necessarily represent the views of his employer(s) or its clients. Read Full Disclosure

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

Up ↑

%d bloggers like this: