HP-UX 11i v3 Using LVM Logical Volume Snapshots (September 2010)
30
Common use examples
The following examples are based on a Version 2.2 volume group vg01 with an 8 MB extent size
and maximum snapshot capacity of 128 TB and an unshare unit of 4 MB. The volume group has a
logical volume /dev/vg01/lvol1 of size 10 GB, with a file system created on it that has the
following files:
# ll /mnt_lvol1/
total 1070408
-rwxrwxrwx 1 root sys 137011480 Jan 26 16:49 file1
-rwxrwxrwx 1 root sys 137011480 Jan 26 16:49 file2
-rwxrwxrwx 1 root sys 137011480 Jan 26 16:49 file3
-rwxrwxrwx 1 root sys 137011480 Jan 26 16:49 file4
drwxr-xr-x 2 root root 96 Jan 26 16:45 lost+found
1. Create a space efficient snapshot of the logical volume /dev/vg01/lvol1 with 50 pre-allocated
extents as follows:
# lvcreate -S s -l 50 –p w /dev/vg01/lvol1
2. Mount this snapshot logical volume on a file system as follows:
# fsck /dev/vg01/lvol1_S2
# mount /dev/vg01/lvol1_S2 /mnt_S2/
# ll /mnt_S2/
total 1070408
-rwxrwxrwx 1 root sys 137011480 Jan 26 16:49 file1
-rwxrwxrwx 1 root sys 137011480 Jan 26 16:49 file2
-rwxrwxrwx 1 root sys 137011480 Jan 26 16:49 file3
-rwxrwxrwx 1 root sys 137011480 Jan 26 16:49 file4
drwxr-xr-x 2 root root 96 Jan 26 16:45 lost+found
# cmp /mnt_lvol1/file1 /mnt_S2/file1
# cmp /mnt_lvol1/file2 /mnt_S2/file2
# cmp /mnt_lvol1/file3 /mnt_S2/file3
# cmp /mnt_lvol1/file4 /mnt_S2/file4
Note
The contents are the same as that of the original logical volume.
3. Perform a write operation on the original logical volume.
# cp /mnt_lvol1/file1 /mnt_lvol1/file5
# ll /mnt_S2
total 1070408
-rwxrwxrwx 1 root sys 137011480 Jan 26 16:49 file1
-rwxrwxrwx 1 root sys 137011480 Jan 26 16:49 file2
-rwxrwxrwx 1 root sys 137011480 Jan 26 16:49 file3
-rwxrwxrwx 1 root sys 137011480 Jan 26 16:49 file4
drwxr-xr-x 2 root root 96 Jan 26 16:45 lost+found
# ll /mnt_lvol1/
total 1338010
-rwxrwxrwx 1 root sys 137011480 Jan 26 16:49 file1
-rwxrwxrwx 1 root sys 137011480 Jan 26 16:49 file2
-rwxrwxrwx 1 root sys 137011480 Jan 26 16:49 file3
-rwxrwxrwx 1 root sys 137011480 Jan 26 16:49 file4
-rwxrwxrwx 1 root sys 137011480 Jan 26 17:02 file5
drwxr-xr-x 2 root root 96 Jan 26 16:45 lost+found