4

There is already a drive connected where the model name of the drive is fixed and we have to play the movie using the same drive but due to crank it gets mounted in different path frequently. Assume when an other drive is connected how do I get to know the other drive?

4

Assuming your udev creates links in /dev/disk/by-id with model and serial number of your drive, you can do:

lsblk -no MOUNTPOINT /dev/disk/by-id/ata-modelxxx_serialyyy | grep -m1 .

To find where the top-most file system mounted in there is mounted on.

(note that it doesn't work for all types of file systems. It doesn't (with my version of lsblk (2.28) at least) work for zfs file systems for instance, but should work more the most common one, including when md raid arrays or LVM is involved).

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.