Can the locations and sizes of logical volumes be provided as command line arguments when mounting LVM partitions? I mean in the way MTD partitions are not defined using a partition table. Does LVM have that option?

  • LVM does not need a partition table, all info is in the metadata it writes. But you cannot (easily) get data off an lvm volume without this metadata and the tools reading it. Yet I am not sure if this was your question. – zhenech Dec 30 '15 at 17:06
  • Is your goal to be able to specify volume sizes via the Do and line? Yes, this you can do. You assign one (or more) disk volumes (or partitions) to a volume group. Then you cream LVM volumes on the command line, specifying their size in either blocks, (mega or Riga)bytes, or as percentage of free or total space – Otheus Dec 31 '15 at 13:44

No, LVM does not need a partition table. In many ways, it's beneficial to work without one. This is because you can nearly always resize the volume or disk and get the kernel to recognize the new size, but you can't always get the kernel to recognize a new partition-size. That, and changing the partition size, while do-able, can be tricky.

If you have blank physical block device /dev/hdx, and you want to put it under LVM, use do:

pvcreate /dev/hdx

and work from there.

  • But how does it know where the sub-partitions are? – Melab Dec 30 '15 at 21:18
  • Well, technically, there are no sub-partitions. LVM keeps a meta-database of information on the volumes themselves and a backup of that information in a file on the host's root filesystem. The information is checksummed and compared. Things become sort of interesting when the boot system is within LVM, such as can happen in grub2. There, grub2 must have enough details about LVM in order to process the LVM meta data. – Otheus Dec 30 '15 at 21:44
  • "Sub-partitions" are what I am calling volumes. – Melab Dec 31 '15 at 4:25
  • So did I answer the question? Or are you wanting to know the details of how LVM ? Or something else? AFAIK, I answered the title of the question, but not necessarily the text if your question. – Otheus Dec 31 '15 at 13:33

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.