1753521 Members
4648 Online
108795 Solutions
New Discussion

LVM device special name

 
SOLVED
Go to solution
Michelle_61
Frequent Advisor

Re: LVM device special name

Many thinks again, Matti.

However, from what you have mentioned, if fstab uses LABEL= or UUID= format to specify device names, then readlink cannot be used to match them in mtab. And that is a situation I cannot exclude.

My real intention is to search in mtab and try to match every FS in fstab. Originally it was written as:
for each line in fstab do
for each line in mtab do
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;
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;
else go to the next line in mtab.

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.

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.

Any suggestions will be appreciated!