I have seen a lot of stuff on how to get the mount point of a disk drive, such as a usb. Okay so the thing was that I wanted to copy all the folders in my usb to another folder automatically after the usb is plugged in(without manually operation). If I use C, then I can only copy one file every time and use some loop but not the whole folder so it takes a long time. So i was thinking of using cp command in shell file to achieve the goal. I use sudo fdisk to get the mount point of the usb, like /dev/sda1. But in copy command I need to use a real directory such as /media/*** (not that pseudo directory). So I was wondering how you could use /dev/sda1 in cp command or at least use it to find the real directory of the usb.
ps: I might have a wrong understanding on mount point Thank you!

  • What items do you want to copy that aren't available via the mount point? – Joe Sewell Feb 17 '15 at 22:04
  • What do you mean by “the path of the usb”? The only meaning I can think of is the mount point. Describe what you're trying to do in a way that someone else can reproduce, e.g. “I plug in a USB drive, it gets mounted automatically at …, …” or “I plug in a USB drive, I mount it with the command , …”. – Gilles Feb 17 '15 at 22:32
  • What do you mean by mount-point?, it seems that you are mixing up terminology, can you give examples. Also tell us what system you are on. Linux is just a kernel, there are many Operating systems based on it most are some variant of Gnu/Linux, but even then there can be differences. A lot of modern systems will mount the usb in /media/usb-name – ctrl-alt-delor Feb 17 '15 at 23:16
  • /dev/sda is the device, not a mount point. The mount point is the directory where you mount the device. Is it mounted automatically ? Where it is mounted will depend on what you use to mount it. – Leiaz Feb 18 '15 at 22:06
  • Yes you can find the mount point of your device with finmdmnt utility. For example if you know that your usb is /dev/sda1 then findmnt -S /dev/sda1 will return the mount point (aka target directory) and other useful stuff, as file system type, etc. BTW, I nominate this question to reopen as last sentences seems quite clear to me (although title is very misleading I must admit). – jimmij Feb 18 '15 at 22:56

The question is somewhat confusing, but I believe you are asking how to find a mount point (e.g. /media/myusb/) by knowing only device name (e.g. /dev/sda1). You can do it for example with findmnt tool:

$ findmnt /dev/sda1
/media/myusb /dev/sda1 iso9660 ro,relatime

you can also search in other direction with findmnt /media/myusb or just list all mounted points with findmnt -l.

It is possible that your system won't have findmnt, so let me also offer as an alternative lsblk /dev/sda1. This tool could be even more powerful as it can list partitions which are not mounted at all (for example if you want to check their size) but it works in "one direction" only.

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.