I'm using Kubuntu 11.10 and before I upgrade to 12.04, I want to make snapshots of my filesystems. Coming to think of that, I realized that it can be very useful to create snapshots of logical volumes during boot before they are mounted. At that moment, the volume/filesystem should be clean and is perfect to be used for an image backup.

How can I create LV snapshots of my filesystems during boot, before the filesystems are being mounted by the kernel? I think this should be done in initrd, but unsure how.

1 Answer 1


Part of the purpose of LVM snapshots is that you can create them on the fly; there is no need to do it at boot time. LVM takes care to make sure the filesystem is in a consistent state when it creates the snapshot. One of, if not the most common use of LVM snapshots is to get a stable fs image you can make a backup of without having to shutdown the server.

  • 1
    Do you have a references stating LVM2 being sufficiently aware of the filesystem to always create snapshots with a consistent filesystem?
    – jippie
    Commented Apr 30, 2012 at 15:39
  • This facility does require that the snapshot be made at a time when the data on the logical volume is in a consistent state - the VFS-lock patch for LVM1 makes sure that some filesystems do this automatically when a snapshot is created, and many of the filesystems in the 2.6 kernel do this automatically when a snapshot is created without patching. tldp.org/HOWTO/LVM-HOWTO/snapshotintro.html - But for a consisten file backup, applications must write their buffers to disk or be closed.
    – jippie
    Commented Apr 30, 2012 at 15:49
  • @jippie, properly behaved applications are designed to recover from a system crash or power failure, which is what it looks like when you take a snapshot on the fly, back it up, and restore it later. Things like database servers and even web browser history work properly when this happens. There may be some poorly behaved applications that can not recover properly from a power failure, so yes, you will want to shut those down before taking the snapshot.
    – psusi
    Commented Apr 30, 2012 at 18:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .