<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: LVM device special name in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/lvm-device-special-name/m-p/4579343#M39617</link>
    <description>Or if there is a function that compares the two paths (/dev/vg/space and /dev/mapper/vg-space) and returns TRUE since they are the same.&lt;BR /&gt;&lt;BR /&gt;Your help will be appreciated!</description>
    <pubDate>Fri, 05 Feb 2010 23:21:25 GMT</pubDate>
    <dc:creator>Michelle_61</dc:creator>
    <dc:date>2010-02-05T23:21:25Z</dc:date>
    <item>
      <title>LVM device special name</title>
      <link>https://community.hpe.com/t5/operating-system-linux/lvm-device-special-name/m-p/4579338#M39612</link>
      <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;In my system the special name for a LVM device is different in /etc/fstab than in /etc/mtab:&lt;BR /&gt;&lt;BR /&gt;e.g. in /etc/fstab, it shows:&lt;BR /&gt;/dev/vg/space           /space  ......&lt;BR /&gt;&lt;BR /&gt;e.g. in /etc/fstab, it shows:&lt;BR /&gt;/dev/mapper/vg-space           /space  ......&lt;BR /&gt;&lt;BR /&gt;I wonder if there is an API can convert this two corresponding special names or at least if there is a fix pattern to transform between these two names?&lt;BR /&gt;&lt;BR /&gt;Thanks in advance!</description>
      <pubDate>Fri, 05 Feb 2010 21:39:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/lvm-device-special-name/m-p/4579338#M39612</guid>
      <dc:creator>Michelle_61</dc:creator>
      <dc:date>2010-02-05T21:39:54Z</dc:date>
    </item>
    <item>
      <title>Re: LVM device special name</title>
      <link>https://community.hpe.com/t5/operating-system-linux/lvm-device-special-name/m-p/4579339#M39613</link>
      <description>This appears to more Linux related than HP-UX.&lt;BR /&gt;&lt;BR /&gt;However, the transition from /dev/vgname/lvname to /dev/mapper/vgname-lvname seems relatively straightforward.&lt;BR /&gt;&lt;BR /&gt;For example, here are some of mine:&lt;BR /&gt;&lt;BR /&gt;cat /etc/mtab:&lt;BR /&gt;/dev/mapper/ediâ  archive /archive ext3 rw,acl,user_xattr 0 0&lt;BR /&gt;/dev/mapper/ediâ  gisprod /gisprod ext3 rw,acl,user_xattr 0 0&lt;BR /&gt;/dev/mapper/ediâ  gistest /gistest ext3 rw,acl,user_xattr 0 0&lt;BR /&gt;/dev/mapper/ediâ  oldarch /oldarch ext3 rw,acl,user_xattr 0 0&lt;BR /&gt;/dev/mapper/ediâ  oraarch /oraarch ext3 rw,acl,user_xattr 0 0&lt;BR /&gt;/dev/mapper/ediâ  oraback /oraback ext3 rw,acl,user_xattr 0 0&lt;BR /&gt;&lt;BR /&gt;cat /etc/fstab:&lt;BR /&gt;/dev/edi/archive     /archive             ext3       acl,user_xattr        1 2&lt;BR /&gt;/dev/edi/gisprod     /gisprod             ext3       acl,user_xattr        1 2&lt;BR /&gt;/dev/edi/gistest     /gistest             ext3       acl,user_xattr        1 2&lt;BR /&gt;/dev/edi/oldarch     /oldarch             ext3       acl,user_xattr        1 2&lt;BR /&gt;/dev/edi/oraarch     /oraarch             ext3       acl,user_xattr        1 2&lt;BR /&gt;/dev/edi/oraback     /oraback             ext3       acl,user_xattr        1 2&lt;BR /&gt;&lt;BR /&gt;Am I missing something in your question?</description>
      <pubDate>Fri, 05 Feb 2010 21:47:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/lvm-device-special-name/m-p/4579339#M39613</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2010-02-05T21:47:33Z</dc:date>
    </item>
    <item>
      <title>Re: LVM device special name</title>
      <link>https://community.hpe.com/t5/operating-system-linux/lvm-device-special-name/m-p/4579340#M39614</link>
      <description>Crazy flippin' cut-and-paste in Windows screwed up the dashes in mtab portion above.&lt;BR /&gt;&lt;BR /&gt;It should be:&lt;BR /&gt;&lt;BR /&gt;cat /etc/mtab:&lt;BR /&gt;/dev/mapper/edi-archive /archive ext3 rw,acl,user_xattr 0 0&lt;BR /&gt;/dev/mapper/edi-gisprod /gisprod ext3 rw,acl,user_xattr 0 0&lt;BR /&gt;/dev/mapper/edi-gistest /gistest ext3 rw,acl,user_xattr 0 0&lt;BR /&gt;/dev/mapper/edi-oldarch /oldarch ext3 rw,acl,user_xattr 0 0&lt;BR /&gt;/dev/mapper/edi-oraarch /oraarch ext3 rw,acl,user_xattr 0 0&lt;BR /&gt;/dev/mapper/edi-oraback /oraback ext3 rw,acl,user_xattr 0 0</description>
      <pubDate>Fri, 05 Feb 2010 22:06:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/lvm-device-special-name/m-p/4579340#M39614</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2010-02-05T22:06:59Z</dc:date>
    </item>
    <item>
      <title>Re: LVM device special name</title>
      <link>https://community.hpe.com/t5/operating-system-linux/lvm-device-special-name/m-p/4579341#M39615</link>
      <description>Yes actually it is for Linux...&lt;BR /&gt;&lt;BR /&gt;What I am trying to do is to write a program to convert the LVM special names. To minimize the risk I might encounter, I need to know if special names start with "/dev/mapper" are only for LVM devices but not other type of devices, and they always transform like that. I also wonder if there are any system APIs I could use to ease the programming.&lt;BR /&gt;&lt;BR /&gt;Thanks!</description>
      <pubDate>Fri, 05 Feb 2010 22:18:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/lvm-device-special-name/m-p/4579341#M39615</guid>
      <dc:creator>Michelle_61</dc:creator>
      <dc:date>2010-02-05T22:18:29Z</dc:date>
    </item>
    <item>
      <title>Re: LVM device special name</title>
      <link>https://community.hpe.com/t5/operating-system-linux/lvm-device-special-name/m-p/4579342#M39616</link>
      <description>I found the device name specified in /etc/fstab is actually a symbolic link to the one specified in /etc/mtab. for example:&lt;BR /&gt;&lt;BR /&gt;# ls -l /dev/vg/space&lt;BR /&gt;lrwxrwxrwx  1 root root 20 Dec  8 09:29 /dev/vg/space -&amp;gt; /dev/mapper/vg-space&lt;BR /&gt;&lt;BR /&gt;Now my problem would be easier if there is a function that takes the /etc/fstab device name as an in param and returns the /etc/mtab device name. The question is if this function exists?</description>
      <pubDate>Fri, 05 Feb 2010 22:43:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/lvm-device-special-name/m-p/4579342#M39616</guid>
      <dc:creator>Michelle_61</dc:creator>
      <dc:date>2010-02-05T22:43:51Z</dc:date>
    </item>
    <item>
      <title>Re: LVM device special name</title>
      <link>https://community.hpe.com/t5/operating-system-linux/lvm-device-special-name/m-p/4579343#M39617</link>
      <description>Or if there is a function that compares the two paths (/dev/vg/space and /dev/mapper/vg-space) and returns TRUE since they are the same.&lt;BR /&gt;&lt;BR /&gt;Your help will be appreciated!</description>
      <pubDate>Fri, 05 Feb 2010 23:21:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/lvm-device-special-name/m-p/4579343#M39617</guid>
      <dc:creator>Michelle_61</dc:creator>
      <dc:date>2010-02-05T23:21:25Z</dc:date>
    </item>
    <item>
      <title>Re: LVM device special name</title>
      <link>https://community.hpe.com/t5/operating-system-linux/lvm-device-special-name/m-p/4579344#M39618</link>
      <description>&lt;!--!*#--&gt;The pattern is:&lt;BR /&gt;/dev/&lt;VGNAME&gt;/&lt;LVNAME&gt; -&amp;gt; /dev/mapper/&lt;VGNAME&gt;-&lt;LVNAME&gt;&lt;BR /&gt;&lt;BR /&gt;In a script, you could convert your /etc/fstab style name to /etc/mtab style (but not vice versa) with "readlink -f". For example, in your case:&lt;BR /&gt;&lt;BR /&gt;readlink -f /dev/vg/space&lt;BR /&gt;&lt;BR /&gt;should return:&lt;BR /&gt;&lt;BR /&gt;/dev/mapper/vg-space&lt;BR /&gt;&lt;BR /&gt;In a program, you can do the same with the readlink() system call.&lt;BR /&gt;&lt;BR /&gt;If you wish to compare two names and see if they point to the same device, you can use the stat()/fstat() functions on both names and compare the stat structures returned. If both have the same st_rdev value, they both point to the same LV.&lt;BR /&gt;&lt;BR /&gt;In a script, you could do something like this:&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;FIRSTDEV=$(stat -L -c '%F.%t.%T' /dev/mapper/vg-space)&lt;BR /&gt;SECONDDEV=$(stat -L -c '%F.%t.%T' /dev/vg/space)&lt;BR /&gt;if [ "$FIRSTDEV" = "$SECONDDEV" ]; then&lt;BR /&gt;    echo "Both names are referring to the same LV"&lt;BR /&gt;else&lt;BR /&gt;    echo "The names point to different LVs, or to something completely different"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;MK&lt;/LVNAME&gt;&lt;/VGNAME&gt;&lt;/LVNAME&gt;&lt;/VGNAME&gt;</description>
      <pubDate>Sat, 06 Feb 2010 19:09:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/lvm-device-special-name/m-p/4579344#M39618</guid>
      <dc:creator>Matti_Kurkela</dc:creator>
      <dc:date>2010-02-06T19:09:03Z</dc:date>
    </item>
    <item>
      <title>Re: LVM device special name</title>
      <link>https://community.hpe.com/t5/operating-system-linux/lvm-device-special-name/m-p/4579345#M39619</link>
      <description>Some background:&lt;BR /&gt;The /dev/mapper directory is the location where the _device-mapper subsystem_ maintains its persistent device names.&lt;BR /&gt;&lt;BR /&gt;The device-mapper subsystem is a basic building block for various disk services, including (but not limited to):&lt;BR /&gt;- LVM (/dev/mapper/vg00-lvol1)&lt;BR /&gt;- disk encryption (/dev/mapper/sda2_crypt)&lt;BR /&gt;- multipathing (/dev/mapper/mpath1)&lt;BR /&gt;- software RAID&lt;BR /&gt;&lt;BR /&gt;Each of these services can have its own naming pattern, and some of these services also create compatibility symlinks in other parts of the /dev hierarchy, for legacy compatibility or other reasons.&lt;BR /&gt;&lt;BR /&gt;There is also /dev/mapper/control, the control device for the device-mapper subsystem itself.&lt;BR /&gt;&lt;BR /&gt;So: no, not all devices in /dev/mapper always refer to LVM devices.&lt;BR /&gt;&lt;BR /&gt;There is "dmsetup": a generic tool for listing and modifying all device-mapper mappings. Try "dmsetup ls --tree": if you have LVM and multipathing, or LVM and disk-encryption, this will display how they work together and what gets mapped into what.&lt;BR /&gt;&lt;BR /&gt;Of course, the service-specific tools are usually more appropriate for common system administration needs.&lt;BR /&gt;&lt;BR /&gt;MK</description>
      <pubDate>Sat, 06 Feb 2010 19:43:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/lvm-device-special-name/m-p/4579345#M39619</guid>
      <dc:creator>Matti_Kurkela</dc:creator>
      <dc:date>2010-02-06T19:43:18Z</dc:date>
    </item>
    <item>
      <title>Re: LVM device special name</title>
      <link>https://community.hpe.com/t5/operating-system-linux/lvm-device-special-name/m-p/4579346#M39620</link>
      <description>Thanks Matti, for the profound information. That really helps a lot!&lt;BR /&gt;&lt;BR /&gt;There are a few more questions:&lt;BR /&gt;1. Is the /dev/&lt;VGNAME&gt;/&lt;LVNAME&gt; pattern always in /etc/fstab, and the /dev/mapper/&lt;VGNAME&gt;-&lt;LVNAME&gt; pattern always in /etc/mtab? In other words, the name in fstab is the sym link of the name in mtab but not the other way.&lt;BR /&gt;2. Which application decides those patterns in the two tab files? And which application actually edits those two tab files for LVM devices?&lt;BR /&gt;&lt;BR /&gt;Thanks, for bearing with me.&lt;/LVNAME&gt;&lt;/VGNAME&gt;&lt;/LVNAME&gt;&lt;/VGNAME&gt;</description>
      <pubDate>Sun, 07 Feb 2010 01:52:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/lvm-device-special-name/m-p/4579346#M39620</guid>
      <dc:creator>Michelle_61</dc:creator>
      <dc:date>2010-02-07T01:52:12Z</dc:date>
    </item>
    <item>
      <title>Re: LVM device special name</title>
      <link>https://community.hpe.com/t5/operating-system-linux/lvm-device-special-name/m-p/4579347#M39621</link>
      <description>1.) In /etc/fstab, you can use either form (or if you have made custom symlinks, really *anything* that points to the device you want).&lt;BR /&gt;&lt;BR /&gt;The mount command always canonicalizes the device name, by reading every symlink and replacing it with the real pathname. The canonicalized form is always used in /etc/mtab.&lt;BR /&gt;&lt;BR /&gt;In /etc/fstab, it's also possible to identify a disk device by LABEL=&lt;VOLUME_LABEL&gt; or UUID=&lt;FILESYSTEM_UUID&gt;. The mount command will use various methods to find the correct device using this information at filesystem mount time. &lt;BR /&gt;&lt;BR /&gt;Use the "man fstab" command to get more information about the structure of the /etc/fstab file. If you are writing your own program, you might want to download the source code of the "mount" command and study the parts that are used to read /etc/fstab.&lt;BR /&gt;&lt;BR /&gt;2.) The content of /etc/fstab is primarily for the "mount" command, but other administration tools may use the data too. &lt;BR /&gt;&lt;BR /&gt;The /etc/fstab file is edited mostly by *you*, the sysadmin. You have the option of using all the helper programs you want.&lt;BR /&gt;&lt;BR /&gt;Some desktop environments *may* include features that automatically add &amp;amp; remove entries to /etc/fstab for USB sticks and other hot-pluggable storage. The current preference seems to be to use HAL and dbus sub-systems for storing such hot-plug information instead of /etc/fstab, though.&lt;BR /&gt;&lt;BR /&gt;If you use a GUI desktop that auto-manipulates /etc/fstab, it's your responsibility as a sysadmin to read the documentation so that you understand how that feature works. In a server system a GUI desktop environment can often be totally left out, so it might be a non-issue.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The /etc/mtab should normally be written by the "mount" command only. As long as the system is operating normally, there should be no need to make any other changes to the /etc/mtab file.&lt;BR /&gt;&lt;BR /&gt;At boot time, the /etc/mtab file is completely cleared and then re-generated as each filesystem is mounted.&lt;BR /&gt;&lt;BR /&gt;If the root filesystem is in read-only state (because of e.g. a hardware problem that affects the root filesystem), the information in /etc/mtab might be out of date. The /proc/mounts is another source for much of the same data, but it has the extra feature of being dynamically generated by the kernel, so it's never out of date.&lt;BR /&gt;&lt;BR /&gt;The /etc/mtab and /proc/mounts files use the same format. The only difference is that when you've granted non-root users permission to mount some devices, /etc/mtab will store extra information to identify filesystems that have been mounted by a non-root user. &lt;BR /&gt;&lt;BR /&gt;You then have the option to configure the system to allow the user-mounted filesystems to be unmounted only by the sysadmin or the user who originally mounted it. This is to prevent users interfering with each other in a multi-user system: user A might be trying to read files from a CD-ROM or memory stick, and user B might keep unmounting it.&lt;BR /&gt;&lt;BR /&gt;MK&lt;/FILESYSTEM_UUID&gt;&lt;/VOLUME_LABEL&gt;</description>
      <pubDate>Sun, 07 Feb 2010 09:42:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/lvm-device-special-name/m-p/4579347#M39621</guid>
      <dc:creator>Matti_Kurkela</dc:creator>
      <dc:date>2010-02-07T09:42:42Z</dc:date>
    </item>
    <item>
      <title>Re: LVM device special name</title>
      <link>https://community.hpe.com/t5/operating-system-linux/lvm-device-special-name/m-p/4579348#M39622</link>
      <description>Many thinks again, Matti.&lt;BR /&gt;&lt;BR /&gt;However, from what you have mentioned, if fstab uses LABEL=&lt;VOLUME_LABEL&gt; or UUID=&lt;FILESYSTEM_UUID&gt; format to specify device names, then readlink cannot be used to match them in mtab. And that is a situation I cannot exclude.&lt;BR /&gt;&lt;BR /&gt;My real intention is to search in mtab and try to match every FS in fstab. Originally it was written as:&lt;BR /&gt;  for each line in fstab do&lt;BR /&gt;     for each line in mtab do&lt;BR /&gt;       if the mount point in fstab is exactly the same as the one in mtab then a match is found, go to the next line in fstab;&lt;BR /&gt;       else if the device name in fstab is exactly the same as the one in mtab then a match is found, go to the next line in fstab;&lt;BR /&gt;       else go to the next line in mtab.&lt;BR /&gt;&lt;BR /&gt;The problem with the above code is, when a symlink is used in fstab for a LVM device, neither the corresponding mount points nor the corresponding device names are exactly the same. Hence the matching logic needs to be modified.&lt;BR /&gt;&lt;BR /&gt;I think I still have another option to fix it. That is, to use the readlink function for a mount point in fstab, that should always return its real path which is listed in mtab, right? I try not to use lstat since it could hang on staled NFS.&lt;BR /&gt;&lt;BR /&gt;Any suggestions will be appreciated!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/FILESYSTEM_UUID&gt;&lt;/VOLUME_LABEL&gt;</description>
      <pubDate>Mon, 08 Feb 2010 02:12:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/lvm-device-special-name/m-p/4579348#M39622</guid>
      <dc:creator>Michelle_61</dc:creator>
      <dc:date>2010-02-08T02:12:25Z</dc:date>
    </item>
  </channel>
</rss>

