Friday, December 13, 2013

Money in the Bank: Fedora Btrfs Filesystem With Yum-plugin-fs-snapshot

by Dietrich Schmitz

The IT Scenario


You are a veteran System Administrator.  You know the drill.  You have an operating system upgrade to do.  It must be done in such a way that there is no 'down time' for the end users in your business setting.

Taking Precautions -- Backup


That, usually means doing it over the weekend when nobody is in the office.  It also means that you must apply due diligence in being sure you have a 'viable' backup set of the system -- not just a differential backup.  So creating one takes time with a decent tape archiver, or, if you are lucky you work for a larger Enterprise Datacenter with a dedicated rack NAS server to stream image the drive across to another hard drive.  But that's pricey and many small- to medium-sized businesses simply can't afford to spend $40,000 or more for such technology.

So, tape back up it is.  It might take 6 hours to complete on a Saturday.  And you hope that verify confirms it is a good set.  Any errors, then you may need to start over switching in a different tape assuming the first has media damage.

It's something you incorporate into standard operational procedure to precede any Change Management request for work on any server upgrade.  Never deviate.  Your job depends on it.

If your system crashes, for whatever reason, you pray your tape backup will restore and the turnaround time to do a restoral can take several hours depending on the tape archiver subsystem being used.

Often Murphy's Law comes into play: "when things can go wrong, they will go wrong."

You discover that something in the install log doesn't look right and the system has decided to abend several times during your post-upgrade testing.

It's now midnight on Saturday.  You need to pull the plug and restore from tape backup so that the system will be 'up' on Monday at 8:00 am.

So, you come back in again Sunday morning and proceed with tape restoral and babysit the job to completion and if you are lucky, the system boots up and is ready for Monday morning's business.  You get to keep your job for another day, maybe the whole week even.

Btrfs and Yum-plugin-fs-snapshot


Today, if you set up your server with Fedora Linux and partition the system using Btrfs filesystem, you get the capability to do snapshots that interleave your hard drive with no need to send the snapshot to an external drive.

The process for doing so is near-instantaneous, a second or two at most to perform.  It's that fast and with Fedora's YUM package manager you also can avail yourself to using the yum-plugin-fs-snapshot plugin which will automatically create a snapshot of your Btrfs filesystem partitions before commencing with your operating system upgrade scenario.  Again, it's just one second to create the snapshot and the yum 'update' to upgrade the O/S proceeds to completion normally.

Post-Install Quick Snapshot Recovery


Were you to encounter problems post-install during your system testing, it takes just one minute to revert to your yum created snapshot and reboot.

This process might take total 2 hours invested time verses the whole weekend consumed using the old tape archiver method.

My Testing


I installed Fedora 20 last evening with Btrfs to test out yum-plugin-fs-snapshot.  Indeed, it works as advertised and all in a matter of a few scant seconds I had a snapshot of the root (/) and home (/home) partitions as backup following my test install of nmap and it's accompanying nmap-frontend gui.  Similarly, it took two seconds to remove the two snapshots.  Below is shown the output from my test:

Install  2 Packages

Total download size: 4.5 M
Installed size: 19 M
Is this ok [y/d/N]: y
Downloading packages:
(1/2): nmap-frontend-6.40-2.fc20.noarch.rpm                | 659 kB   00:01     
(2/2): nmap-6.40-2.fc20.i686.rpm                           | 3.8 MB   00:04     
--------------------------------------------------------------------------------
Total                                           1.1 MB/s | 4.5 MB     00:04     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
fs-snapshot: snapshotting /: /yum_20131213160036
fs-snapshot: snapshotting /home/: /home/yum_20131213160036
  Installing : 2:nmap-6.40-2.fc20.i686                                      1/2
  Installing : 2:nmap-frontend-6.40-2.fc20.noarch                           2/2
  Verifying  : 2:nmap-frontend-6.40-2.fc20.noarch                           1/2
  Verifying  : 2:nmap-6.40-2.fc20.i686                                      2/2

Installed:
  nmap.i686 2:6.40-2.fc20           nmap-frontend.noarch 2:6.40-2.fc20          

Complete!
New leaves:
  nmap-frontend.noarch
[dietrich@localhost~]$

Then, I deleted snapshots just created:

[dietrich@localhost~]$ sudo btrfs subvolume delete /yum_20131213160036/
[sudo] password for dietrich:
Delete subvolume '//yum_20131213160036'
[dietrich@localhost~]$ sudo btrfs subvolume delete /home/yum_20131213160036/
Delete subvolume '/home/yum_20131213160036'
[dietrich@localhost~]$

Conclusion


So, there you have it.  Some technologies are just 'better' than others, yes?
This is why I endorse Fedora Linux.

Get your server configured with Fedora's Btrfs and Yum-plugin-fs-snapshot and have some peace of mind.

Money in the Bank. -- Dietrich
Enhanced by Zemanta

0 comments:

Post a Comment