Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

So I can do the following:

mount /dev/datavg/datalv /mnt

or

mount /dev/mapper/datavg-datalv /mnt

Are these the same? Is their an advantage to one over the other? Is one better practice?

share|improve this question
1  
Check if they return the same device when listing with ls -la. If that's the case, they are equivalent. However, I've always preferred /dev/mapper because it is easier to read and mentally sort in /etc/fstab (at least for me). –  jaume Mar 1 '13 at 14:51
    
Thanks for the info. I especially appreciate you showing me how to find the info for myself. Both symlinks appear to point to the same device. –  HayekSplosives Mar 1 '13 at 15:41
    
You're welcome, I've expanded my comment as an answer and added a reason as to why you should use /dev/mapper devices in /etc/fstab. Take a look at it. –  jaume Mar 1 '13 at 18:55

1 Answer 1

up vote 1 down vote accepted

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 or fdisk:

# 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 /etc/fstab.

share|improve this answer
    
I think the best method to mount partitions is using UUID instead of a fixed block device path in /etc/fstab. Because udev sets up these device files and if your udev is broken you have exactly the issue as you describe. Using UUID you didn't have these problems at all. –  morlix Mar 2 '13 at 10:18
    
Yes, you can use UUIDs, but remember that mount looks for entries in /dev/disk/by-uuid/ (see man mount), which are symlinks to the device files. The symlinks are created by udev (find the specific rule grepping for "by-uuid" in /lib/udev/rules.d/ or /etc/udev/rules.d/), so when using UUIDs you depend on udev too. –  jaume Mar 6 '13 at 12:39
    
This is probably the best and most comprehensive answer I've gotten. Thank you very much –  HayekSplosives Mar 8 '13 at 17:58
    
Thank you very much, I'm glad I could help. –  jaume Mar 8 '13 at 18:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.