Creating thin-provisioned volumes using Logical Volume Manager (LVM) provides a means of managing overall storage space as well as providing for the use of Snapper. Snapper provides snapshot functionality similar to that available on NetApp's Ontap storage operating system.
Add a New Disk Group:
If you have a large group of disks that you want to make into a new Disk Group, use the MegaRAID Storage Manager to create the desired Virtual Disk (VD). The Storage Manage GUI has a wizard that will step you through the process. Shortly after creating a new VD, the RAID controller will start an "initialization scan". This is actually just a simple block level integrity scan and does not alter any data on the disks. You can continue to use the VD while this scan is taking place.
If you created a new Disk Group you should now have a new Virtual Disk (VD) ready to be used by Linux. This should be visible as a new SCSI device of the appropriate size. Determine the device path of the new VD with sfdisk:
# sfdisk -l
Now initialize the new device as an LVM Physical Volume (PV) with pvcreate (assuming we've added /dev/sde in this example):
# pvcreate /dev/sde
This new PV can be added to an existing or new LVM Volume Group (VG).
# vgextend vg1 /dev/sde
or
# vgcreate vg2 /dev/sde
The new space in the VG can be used to create a new thin-provisioned LVM Logical Volume (LV). The first step is to create a provisioning "pool" in the volume group.
# lvcreate -L50T --thinpool datapool1 vg1
Next we create a thin-provisioned Logical Volume using the storage pool just created, then format this as an XFS file system and mount the file system. For example:
# lvcreate -L25T --thin -n data2 vg1/datapool1 # mkfs.xfs -i size=512 /dev/vg1/data2 # mount /dev/mapper/vg1_data2 /data2
Setting up Snapper
Snapper is an open source utility created by SUSE Linux and offered on many other Linux variants, including Enterprise Linux 7. After initializing Snapper on a thin-provisioned mountedd XFS file system, a variety of commands can be used to configure, schedule, mount and unmount snapshots.
Create the initial Snapper configuration
# snapper -c data2 create-config --fstype "lvm(xfs)" /data2
This will create a configuration entry in /etc/snapper/configs/. You can view and modify this configuration using either the 'snapper get-config' command and the 'snapper set-config' commands
# snapper -c data2 get-config # snapper -c data2 set-config TIMELINE_LIMIT_HOURLY=12 # snapper -c data2 set-config TIMELINE_LIMIT_DAILY=14
Using snapshots
Here are some of the commands to create, list, compare, mount, unmount and delete snapshots
# snapper -c data2 create --type [pre|post|single] # snapper -c data2 list # snapper -c data2 status <firstnum>..<lastnum> # snapper -c data2 mount <number> # snapper -c data2 umount <number> # snapper -c data2 delete <number>