So I can do the following:
mount /dev/datavg/datalv /mnt
mount /dev/mapper/datavg-datalv /mnt
Are these the same? Is their an advantage to one over the other? Is one better practice?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
To check whether they are the same see what
ls -la lists for both files:
$ ls -l /dev/datavg/datalv lrwxrwxrwx 1 root root 25 2013-03-01 19:02 /dev/datavg/datalv -> /dev/mapper/datavg-datalv $ ls -l /dev/mapper/datavg-datalv brw------- 1 root root 253, 0 2013-03-01 19:02 /dev/mapper/datavg-datalv
As you see, there's a small difference:
/dev/mapper/datavg-datalv is a device file while
/dev/datavg/datalv is a symbolic link.
Although both paths they are interchangeable in commands like
# mount /dev/datavg/datalv /mnt # mount /dev/mapper/datavg-datalv /mnt
my experience is that you should use the device file in
/etc/fstab, for example:
/dev/mapper/datavg-datalv /mnt ext3 acl,user_xattr 1 2
How come I recommend this? A couple of years ago I had an issue with a server that didn't come up after a reboot and the cause was a missing device symlink for an LVM filesystem listed in
The answers above are spot-on about checking to see if they are identical. However, I have found a place where the syntax can make a difference for some flavors of Linux:
In Ubuntu 14.04, I've discovered that LVM isn't brought online automatically for mount points with a device path of /dev/VG/LV -- the device path must be in the form /dev/mapper/vg--lv before the system will bring up LVM (i.e. invoke vgscan/vgchange) at boot time.
Maybe this changed since the question was asked, but the man pages for LVM2 state (emphasis mine):
A directory bearing the name of each Volume Group is created under
/devwhen any of its Logical Volumes are activated. Each active Logical Volume is accessible from this directory as a symbolic link leading to a device node. Links or nodes in
/dev/mapperare intended only for internal use and the precise format and escaping might change between releases and distributions. Other software and scripts should use the
/dev/VolumeGroupName/LogicalVolumeNameformat to reduce the chance of needing amendment when the software is updated. Should you need to process the node names in
/dev/mapper, you may use
dmsetup splitnameto separate out the original VG, LV and internal layer names.
Therefore, you should use
mount /dev/datavg/datalv /mnt
splitname device_name [subsystem] Splits given device name into subsystem constituents. The default subsystem is LVM. LVM currently generates device names by concatenating the names of the Volume Group, Logical Volume and any internal Layer with a hyphen as separator. Any hyphens within the names are doubled to escape them. The precise encoding might change without notice in any future release, so we recommend you always decode using the current version of this command.
Here's a usage example:
# dmsetup splitname /dev/mapper/datavg-datalv VG LV LVLayer /dev/mapper/datavg datalv
Interestingly, on my system,
/dev/mapper/datavg does not exist so I'm puzzled by that output.