mount #shows currently mounted devices lsblk #shows currently mounted devices and disk and partition info.
/etc/fstab #configurationfile for mount during startup /etc/mtab #shows currently mounted file systems /proc/mounts #kernel information currently mounted partitions/devices
“/proc/mounts” is more reliable in conflicts/ problems than “/etc/mtab” !!
cat /proc/filesystems cat /proc/partitions
/dev/hda #primary master IDE hard disk /dev/hdb #primary slave IDE hard disk /dev/hdc #secondary master IDE hard disk /dev/hdd #secondary slave IDE hard disk /dev/hda1 #first partition on first IDE hard drive /dev/hda2 #second partition on first IDE hard drive /dev/sdc1 #first partition on third SCSI hard drive /dev/hda5 #first logical partition on first IDE hard drive /dev/hda6 #second logical partition on first IDE hard drive /dev/sdb #second SCSI hard disk
/dev/disk/by-id/scsi-SATA_SAMSUNG_SP0822NS06QJ1EL504745-part1 / ext3 defaults 1 1 /dev/disk/by-id/scsi-SATA_SAMSUNG_SP0822NS06QJ1EL504745-part2 /home ext3 defaults 1 2 /dev/disk/by-id/scsi-SATA_SAMSUNG_SP0822NS06QJ1EL504745-part3 swap swap defaults 0 0 /dev/sda1 / ext3 defaults 1 1 /dev/sda2 /home ext3 defaults 1 2 /dev/sda3 swap swap defaults 0 0 proc /proc proc defaults 0 0 sysfs /sys sysfs noauto 0 0 debugfs /sys/kernel/debug debugfs noauto 0 0 usbfs /proc/bus/usb usbfs noauto 0 0 devpts /dev/pts devpts mode=0620,gid=5 0 0
# by device name : /dev/sda2 /home ext3 defaults 1 2 #mount by K # by label: LABEL=data /home ext3 defaults 1 2 #mount by L # by UUID: UUID=e7f91e7b-6218-4a95-86e4-bc9068471e6c /home ext3 defaults 1 2 #mount by U # by ID: /dev/disk/by-id/scsi-SATA_SAMSUNG_SP0822NS06QJ1EL504745-part2 /home ext3 defaults 1 2 #mount by I # by Device Path: /dev/disk/by-path/pci-0000:00:1f.1-scsi-0:0:0:0-part2 /home ext3 defaults 1 2 #mount by P
mount /dev/device #Show in "/etc/fstab" with editor like vi. mount /dev/sda1 /mnt mount /dev/hdc /mnt/cdrom mount -o loop,ro image_file.iso /iso #mount *.iso file
mount -a #mount all mount -o remount /dev/sdb1 #remount
ls -l /dev/disk/by-uuid
The fourth column in fstab lists all the mount options for the device or partition. This is also the most confusing column in the fstab file, but knowing what some of the most common options mean, saves you from a big headache. Yes, there are many options available, but I'll take a look at the most widely used ones only. For more information, check out the man page of mount.
auto and noauto With the auto option, the device will be mounted automatically (at bootup, just like I told you a bit earlier, or when you issue the mount -a command). auto is the default option. If you don't want the device to be mounted automatically, use the noauto option in /etc/fstab. With noauto, the device can be mounted only explicitly.
user and nouser These are very useful options. The user option allows normal users to mount the device, whereas nouser lets only the root to mount the device. nouser is the default, which is a major cause of headache for new Linux users. If you're not able to mount your cdrom, floppy, Windows partition, or something else as a normal user, add the user option into /etc/fstab.
exec and noexec exec lets you execute binaries that are on that partition, whereas noexec doesn't let you do that. noexec might be useful for a partition that contains binaries you don't want to execute on your system, or that can't even be executed on your system. This might be the case of a Windows partition.
exec is the default option, which is a good thing. Imagine what would happen if you accidentally used the noexec option with your Linux root partition…
ro Mount the filesystem read-only.
rw Mount the filesystem read-write. Again, using this option might cure the headache of many new Linux users who are tearing their hair off because they can't write to their floppies, Windows partitions, or something else.
sync and async How the input and output to the filesystem should be done. sync means it's done synchronously. If you look at the example fstab, you'll notice that this is the option used with the floppy. In plain English, this means that when you, for example, copy a file to the floppy, the changes are physically written to the floppy at the same time you issue the copy command.
However, if you have the async option in /etc/fstab, input and output is done asynchronously. Now when you copy a file to the floppy, the changes may be physically written to it long time after issuing the command. This isn't bad, and may sometimes be favorable, but can cause some nasty accidents: if you just remove the floppy without unmounting it first, the copied file may not physically exist on the floppy yet!
async is the default. However, it may be wise to use sync with the floppy, especially if you're used to the way it's done in Windows and have a tendency to remove floppies before unmounting them first.
defaults Uses the default options that are rw, suid, dev, exec, auto, nouser, and async.
umount /dev/device umount /dev/sr0 umount -lf /device #forcefully umount. If this doesn´t work -> reboot
Show active processes with
lsof | grep /mnt/xxx
mount -o remount,rw /