MongoDB Documentation, Release 3.0.4 Snapshots Overview Snapshots work by creating pointers between the live data and a special snapshot volume. These pointers are the- oretically equivalent to “hard links.” As the working data diverges from the snapshot, the snapshot process uses a copy-on-write strategy. As a result the snapshot only stores modified data. After making the snapshot, you mount the snapshot image on your file system and copy data from the snapshot. The resulting backup contains a full copy of all data. Snapshots have the following limitations: If all writes are not on disk when the backup occurs, the backup will not reflect these changes. If writes are in progress when the backup occurs, the data files will reflect an inconsistent state. With journaling all data-file states resulting from in-progress writes are recoverable; without journaling you must flush all pending writes to disk before running the backup operation and must ensure that no writes occur during the entire backup procedure. If you do use journaling, the journal must reside on the same volume as the data. Alternately, store all MongoDB data files on a dedicated device so that you can make backups without duplicat- ing extraneous data. Snapshots With Journaling If your mongod instance has journaling enabled, then you can use any kind of file system or volume/block level snapshot tool to create backups. If you manage your own infrastructure on a Linux-based system, configure your system with LVM to provide your disk packages and provide snapshot capability. You can also use LVM-based setups within a cloud/virtualized environment. Note: Running LVM provides additional flexibility and enables the possibility of using snapshots to back up Mon- goDB. Snapshots with Amazon EBS in a RAID 10 Configuration If your deployment depends on Amazon’s Elastic Block Storage (EBS) with RAID configured within your instance, it is impossible to get a consistent state across all disks using the platform’s snapshot tool. As an alternative, you can do one of the following: • Flush all writes to disk and create a write lock to ensure consistent state during the backup process. • Configure LVM to run and hold your MongoDB data files on top of the RAID within your system. If you choose this option see Create Backups on Instances that do not have Journaling Enabled (page 246). If you choose this option, perform the LVM backup operation described in Create a Snapshot (page 245). • Snapshots create an image of an entire disk image. Unless you need to back up your entire system, consider isolating your MongoDB data files, journal (if applicable), and configuration on one logical disk that doesn’t contain any other data. • Ensure that you copy data from snapshots and onto other systems to ensure that data is safe from site failures. • Although different snapshots methods provide different capability, the LVM method outlined below does not provide any capacity for capturing incremental backups. • The database must be valid when the snapshot takes place. This means that all writes accepted by the database need to be fully written to disk: either to the journal or to data files. Chapter 5. Administration 244