Home > Technology > Boot Time versus LVM Snapshots

Boot Time versus LVM Snapshots

January 21, 2013

Linux tip: LVM snapshots are a handy feature, but they will destroy your boot time if they diverge very far.

I do a lot of development and testing in virtual machines. Sometimes if I want to try something disruptive, I’ll do it in a clone of some base image. Using LVM snapshots makes it easy and quick to create the new image.

But recently I noticed my workstation was taking abnormally long to boot. The command “systemd-analyze blame” told me that fedora-storage-init.service alone was taking over two minutes. While I imagine this might happen occasionally with fsck, it certainly shouldn’t take so long every time.

I finally found out that the culprit was the LVM vgchange command which initializes the volumes, and apparently this can take quite a while with snapshots to enumerate the extents.  I had a few old snapshotted machines I had used for testing, and the base images those had originated from had since diverged quite a bit due to simple update activity.

I didn’t need those tests anymore, so delete them and reboot — and I booted in only 15 seconds, which even includes a few seconds to enter the encryption passphrase!  This is an order of magnitude faster — or rather, now I know the LVM snapshots were causing an order of magnitude slowdown.

Lesson learned, don’t keep LVM snapshots around for a long time.  It’s too bad, because this capability is otherwise very useful…

About these ads
  1. January 29, 2013 at 11:10 AM

    I just discovered from the Fedora 19 feature YumFsSnapshotThinpSupport that there was already a F17 feature ThinProvisioning. This looks like it might be a better way for me to manage VM storage and snapshots.

    https://fedoraproject.org/wiki/Features/YumFsSnapshotThinpSupport

    https://fedoraproject.org/wiki/Features/ThinProvisioning

    It’s not clear to me how easily I could convert my existing LVM configuration, but it’s worth investigating.

  1. No trackbacks yet.
Comments are closed.
Follow

Get every new post delivered to your Inbox.

%d bloggers like this: