When assigned by default, these names take the form
/dev/vgnn/lvolN
(the block device file
form) and
/dev/vgnn/rlvolN
(the character device file form). The number
N
starts at 1 and
increments in the order that logical volumes are created within each volume group.
When LVM creates a logical volume, it creates both block and character device files. LVM then
places the device files for a logical volume in the appropriate volume group directory. For example,
the default block name for the first logical volume created in volume group
vg01
has the following
full path name:
/dev/vg01/lvol1
If you create a logical volume to contain a sales database, you can name it explicitly as follows:
/dev/vg01/sales_db_lv
After the logical volume in the previous example is created, it has two device files:
/dev/vg01/
sales_db_lv
for the block device file and
/dev/vg01/rsales_db_lv
for the character, or
raw, device file.
Physical Volume Group Names
Physical volume groups are useful for mirroring and are discussed in
“Increasing Performance
Through I/O Channel Separation” (page 33)
. The only naming restriction is that within a volume
group, each physical volume group must have its own unique name. For example, the volume
group
/dev/vg02
might have two physical volume groups named
pvg1
and
pvg2
.
Snapshot Logical Volume Names
The
lvcreate
command is used to create a snapshot logical volume, and its
-n
option can specify
the name of the snapshot logical volume. If this option is not used, then the snapshot logical volume
name defaults to the string comprising of the original logical volume name, the tag
S
, and the
snapshot volume minor number
N
, where
N
is the decimal equivalent of the least significant 12
bits of the snapshot volume's minor number. The range for
N
is 1 to 2047.
Additionally, you can use the
lvcreate -t
option to append the timestamp to the snapshot
volume name. The timestamp is of the form:
YYYYMMDD_HH.MM.SS
. The default is to not append
a timestamp to the name of the snapshot. The lvcreate(1M) manpage provides full details on
creating snapshot logical volumes. See
“Creating and Administering Snapshot Logical Volumes”
(page 103)
for more information about snapshot logical volumes.
Device Number Format
The device files associated with LVM reside in the
/dev
directory. For each volume group, a
directory under
/dev
is named after the volume group. In that directory is a single “group” device
file and separate block and character device files for each logical volume.
The following is a sample listing:
# ls -l /dev/vg01
total 0
crw-r--r-- 1 root root 64 0x010000 Mar 28 2004 group
brw-r----- 1 root root 64 0x010001 Jul 29 16:53 lvol1
brw-r----- 1 root root 64 0x010002 Jul 29 16:53 lvol2
crw-r----- 1 root root 64 0x010001 Mar 28 2004 rlvol1
crw-r----- 1 root root 64 0x010002 Mar 28 2004 rlvol2
By default, volume group numbering begins with zero (
vg00
), while logical volumes begin with
one (
lvol1
). This is because the logical volume number corresponds to the minor number and the
volume group's group file is assigned minor number 0.
Physical volumes use the device files associated with their disk. LVM does not create device files
for physical volumes.
LVM Device File Usage
15