Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

maybe this is a simple thing but I have the following doubt.

If I perform fdisk -l, in the output I can find these devices that represent 2 partitions on the /dev/sdb device that is my SD card:

Dispositivo Boot      Start         End      Blocks   Id  System
/dev/sdb1            8192      122879       57344    c  W95 FAT32 (LBA)
/dev/sdb2          122880    15523839     7700480   83  Linux

From this output can I know is these partitions are mounted or unmounted ? (I think no).

What can I do to know if a specific partition is mounted on my system?

share|improve this question
up vote 5 down vote accepted

The mount command is the usual way. On Linux, you can also check /etc/mtab, or /proc/mounts.

share|improve this answer
    
Note that mount simply displays the contents of /etc/mtab, which is a static file that can become out-of-date (most notably if the root fs is mounted read-only, but also if mounts are changed via direct syscalls rather than using the mount and umount utilities). /proc/mounts is guaranteed to be accurate, but obviously only exists if the /proc filesystem is correctly mounted. df reads /etc/mtab via the functions in <mntent.h>, so is no more reliable than this method. – Jules Jun 4 '14 at 0:34
    
@Jules, on some distros, /etc/mtab is actually a symlink to /proc/mounts. – cjm Jun 4 '14 at 5:55
    
@cjm I didn't know that; I'm a long-time debian/ubuntu user, where it isn't. – Jules Jun 4 '14 at 6:13

You can also use df, which will give you a nicer printout and show the disk usage of the mounted file systems:

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda3        27G  8.6G   17G  35% /
dev             2.0G     0  2.0G   0% /dev
run             2.0G  488K  2.0G   1% /run
tmpfs           2.0G  456K  2.0G   1% /dev/shm
tmpfs           2.0G     0  2.0G   0% /sys/fs/cgroup
tmpfs           2.0G  738M  1.3G  38% /tmp
/dev/sdb2       715G  515G  164G  76% /home
tmpfs           396M  4.0K  396M   1% /run/user/1000
share|improve this answer

I suppose you could use the command blkid to list what is mounted (DQMOT). I would suggest setting up your sudo gedit /etc/fstab - if you didn't know of it - with the outputs for the hard drives blkid picks up. The UUIDs "universally unique identifier" are a better way of mounting than other methods.

For example:

# <file system> <mount point>                   <type>  <options>                      <dump>  <pass>
UUID=9ee10f9f-c7fa-4c94-93dc-d8ca02db9c2f /     ext4    errors=remount-ro              0       1
UUID=48ee8-657-3154044569-d52005b00ded-68 none  swap    sw                             0       0
UUID=C8CE6F14CE6EF9D8 /media/john/windows       ntfs    defaults                       0       0
UUID=F4644D2D644CF3C0 /media/john/e             ntfs    defaults                       0       0

You can also often see in the file manager GUI: win+e and look at whether or not the disks are mounted with the up-turned arrows. You can also mount/un-mount from this menu.

enter image description here

share|improve this answer
    
Thanks, but this shows what's mounted, but not the device node, so it wouldn't answer the original question - how can I see which device nodes are actually mounted? Is there a way of showing device nodes in this GUI? – Rich Homolka Jun 3 '14 at 19:47

The simplest way is use the command mount:

 $ mount
 /dev/sda1 on / type ext4 (rw,errors=remount-ro)
 proc on /proc type proc (rw,noexec,nosuid,nodev)
 sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
 none on /sys/fs/cgroup type tmpfs (rw)
 none on /sys/fs/fuse/connections type fusectl (rw)
 none on /sys/kernel/debug type debugfs (rw)
 none on /sys/kernel/security type securityfs (rw)
 udev on /dev type devtmpfs (rw,mode=0755)
 devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
 tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
 none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
 none on /run/shm type tmpfs (rw,nosuid,nodev)
 none on /run/user type tmpfs (rw,noexec,nosuid,nodev,size=104857600,mode=0755)
 none on /sys/fs/pstore type pstore (rw)
 /dev/sda6 on /home type ext4 (rw)
 binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
 rpc_pipefs on /run/rpc_pipefs type rpc_pipefs (rw)
 systemd on /sys/fs/cgroup/systemd type cgroup (rw,noexec,nosuid,nodev,none,name=systemd)

This information is stored in /etc/mtab, you can see by yourself that the output of mount is nearly identical to that of /etc/mtab

share|improve this answer

How about gnome-disks? Depending on the Ubuntu release, it appears in classic menus as Disks under either Accessories or Utilities?

It gives a graphical map of each disc unit and full details of device name, size, mount status, etc, and also allows mount/dismount. It has the advantage over mount of showing both mounted and unmounted partitions, but as a GUI program it does not have an output that can be piped to other processes in a script. Unlike blkid it does not need root priveleges.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .