I have a Live CD that I am creating that will access all physically attached disks on a machine. There is no user intervention involved and I need to find and mount all drives that can be mounted. I also need to be able to handle if the disk or disks are using LVM or not and mount each volume group.
Here is what I came up with to find and mount all disks available. This script will also keep track of all failed mounts (which I needed in my situation as well, not part of the question but could be useful to others).
Here I scan all partitions in
This may or may not be dependent on the distro but since I am integrating this into a live CD it does not have to be distro independent.
Only the LVM part
Activate all volume groups first:
should give you a list of the activated LVM volumes. They should be of the form