Is it possible to pvcreate a pv by any more unique means than the standard "/dev/sdX"?

The reason is the external multiple hard drive dock and dev mapper on my system don't always assign the same "/dev/sdX" at boot. I work around this with ext4 mounts in fstab by mounting by uuid, otherwise the results could be disastrous reads/writes to the wrong disk.

  • 1
    That's not an obvious reason in itself. Typically pvcreate is a one-off operation. Re-numbering the disks afterwards won't cause any problem. – sourcejedi Dec 5 '16 at 16:31

You could use any of the names that appear up with the command as follows.

ll /dev/disk/by-*

Which are obviously symlinks to the corresponding /dev/sdx device again.

|improve this answer|||||
  • not by-path though :-P – sourcejedi Dec 5 '16 at 16:21
  • and presumably not by-uuid. Which leaves partuuid (if using GPT) and by-id, particularly by-id/wwn-* if possible, and again presumably not lvm-pv-uuid-*. – sourcejedi Dec 5 '16 at 16:25

You'll have to read the man lvm.conf manpage for a full explanation but your LVM filter is probably set up to ignore the disks. On my system it's set to filter = [ "a/.*/" ] which adds (hence the a) anything that matches the given regexp (which is /.*/, i.e everything). Your LVM filter may include some rejects (which would be indicates by a r).

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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