Unixoid Mounting Commands

This topic was published by and viewed 2219 times since "". The last page revision was "".

Viewing 1 post (of 1 total)
  • Author

  • DevynCJohnson
    • Topics - 437
    • @devyncjohnson

    The "mount" command is used to mount filesystems. Unixoid systems view all filesystems as one big file-hierarchy which is under "/". Mounting provides a way to connect a filesystem to this single file-hierarchy.

    The basic template used with the "mount" command is mount -t FS-TYPE DEVICE MOUNTPOINT. The "-t" parameter is used to specify the type of filesystem.

    Mounting Examples

    Below is a list of commands and parameters that are used with the "mount" command (or similar mount commands) on Unixoid systems (such as Linux). The list gives the template for the command needed to mount the specified filesystem.

    Some of the listed mount commands may not work on a particular system. Some operating systems do not support certain filesystems. The operating system may need to have additional drivers or libraries installed to gain support for a given filesystem. Also, some of these filesystems require FUSE and the FUSE components for the particular filesystem.

    Remember replace the template's path with the path/directory that is needed for the user's particular needs. Also, if the user needs to access or mount a filesystem without requiring Root privileges, try using GNOME Virtual FileSystem (GVFS) and Filesystem in Userspace (FUSE).

    • adfs - mount -t adfs /dev/fd0 /mnt/floppy
    • affs -
      • mount -t affs -o offset=2099544064 /dev/sdf /media/Amiga
      • mount -t affs /dev/loop1 /media/Amiga # already mounted to a loopback device
    • aufs -
      • mount -t aufs -o br:/mnt/disk1=rw:/mnt/disk2=rw: /mnt/disk3=rw,sum,create=mfs none /mnt/aufs
      • auplink /aufs/root flush && mount -o remount,mod:/writable/mount_point=ro /aufs/root
    • cifs -
      • mount -t cifs //SERVER/SHARE /mnt/cifs -o username=USRNAME,password=PSSWD,domain=DOMAIN-NAME
      • mount -t cifs //SERVER/SHARE /MOUNTPOINT --verbose -o user=USRNAME
    • cramfs - mount -t cramfs -o loop /path/cramfs-img /media/cramfs/
    • debugfs - mount -t debugfs none /sys/kernel/debug
    • devpts - mount -t devpts devpts /dev/pts
    • efs - mount -r -t efs /dev/cdrom /mnt/irix
    • ext2 -
      • mount -t ext2 /dev/sda1 /media/hdd
      • mount -t ext2fs /dev/wd0s3 /mnt # ext2 on FreeBSD
    • ext3 - mount -t ext3 /dev/sda1 /media/hdd
    • ext4 - mount -t ext4 /dev/sda1 /media/hdd
    • hfs - mount -t hfs /dev/sdc2 /media/hfs # Journaling may need to be disabled
    • hfsplus - mount -t hfsplus /dev/sdc2 /media/hfs # Journaling may need to be disabled
    • hpfs - mount -t hpfs /dev/hda2 /mnt
    • iso9660 - mount -t iso9660 -o ro /dev/cdrom /mnt
    • jffs2 - mount -t jffs2 /dev/mtdblock0 /mnt/jffs2
    • jfs - mount -o noatime -t jfs /dev/jfs_dev /mnt/jfs
    • jmtpfs - jmtpfs ~/mtp # mounts the first found MTP device
    • minix - losetup /dev/loop0 minix.img -o 512 && mount -t minix /dev/loop0 /mnt
    • mp3fs - mp3fs -b 192 /media/music/ ~/fuse/mp3/ -o allow_other,ro
    • msdos - mount -t msdos /dev/sda1 /mnt
    • mtpfs - mtpfs -o allow_other /mnt
    • nfs - mount -t nfs SERVER:/SHARE /mnt/nfs/shares
    • nfs4 - mount -t nfs4 -o proto=tcp,port=2049 SERVER:/SHARE /mnt/nfs/shares
    • ntfs - mount -t ntfs /dev/sda1 /mnt
    • OverlayFS - mount -t overlayfs -o lowerdir=/dir1_ro,upperdir=/main_overlay overlayfs /mnt/overlay
    • proc - mount -t proc none /proc
    • qnx4 -
      • mount -t qnx4 /dev/sda1 /mnt
      • mount -t qnx4fs /dev/sda1 /mnt
    • ramfs - mount -t ramfs -o size=512m ramfs /mnt/ramdisk
    • reiserfs - mount -t reiserfs -o nolog /dev/sdb1 /mnt/reiser
    • romfs - mount -o loop file.img /mnt/img/
    • SSHFS - sshfs USER@HOST:/home/USER/ /mnt/sshfs
    • smbfs - mount -t smbfs //SERVER/SHARE /mnt/smb/share –o username=USER,workgroup=WORKGROUP,password=PSWD
    • squashfs - mount -t squashfs -o loop /dir/file.squashfs /mnt/
    • sysfs - mount -t sysfs sys /sys
    • tmpfs - mount -t tmpfs -o size=512m tmpfs /mnt/ramdisk
    • u2fs - mount -t u2fs /dev/hdb3 /mnt
    • ubifs -
      • mount -t ubifs ubiX:NAME /mnt/ubifs
      • mount -t ubifs /dev/ubi0 /mnt/ubifs
    • udf - mount -t udf /dev/sr0 /cdrom/
    • ufs - mount -r -t ufs -o ufstype=old,ro /dev/sda1 /media/ufs
    • umsdos - mount -t umsdos /dev/sdb2 /media/umsdos
    • UnionFS -
      • mount -t unionfs -o dirs=/dir1:/dir2 > none /mnt/union
      • mount -t unionfs -o dirs=/dir1_rw=rw:/dir2_ro=ro unionfs /mnt/union
    • usbfs - mount -t usbfs none /proc/bus/usb -o devmode=0666
    • vfat - mount -t vfat /dev/sda1 /mnt
    • WikipediaFS - mount.wikipediafs /mnt/wiki
    • xfs - mount -t xfs /dev/sda1 /mnt
    • xiafs - mount -t xiafs /dev/sdc1 /mnt

    Special Mounts

    • *.img Files - mount -o loop FILE.img /mnt/img/
    • *.img File Containing NTFS - fusermount -d ntfs-3g unused mount.ntfs-3g FILE.img /mnt
    • *.iso Files -
      • mount -o loop FILE.iso /mnt/iso
      • mount -o loop -t iso9660 FILE.iso /mnt/iso
    • bindfs - bindfs --perms=a-w /DIRECTORY/PATH /mnt/bindfs
    • Floppies - mount /dev/fd0 /mnt
    • Zip Drive - mount -t vfat /dev/zip /mnt/zip

    Miscellaneous Mount Commands

    Executing mount will output a list of mounted filesystems. The contents of the output looks similar to the "mount table" (/etc/mtab).

    Executing mount -a will mount all filesystems listed in the "filesystem table" (/etc/fstab). However, executing mount -l -t FILESYSTEM will list all mounted filesystems of the specified type.

    Executing unmount -a will unmount all filesystems listed in the "mount table" (/etc/mtab). When mounting a filesystem using the "-n" parameter, the filesystem will not be listed in /etc/mtab. This is useful when a partition must be mounted during a time that /etc/ is read-only.

    Filesystems can be set to unmount when all disk operations are complete. For instance, issue the command unmount -l /MOUNT_POINT which will unmount the filesystem after no more disk operations occur on the filesystem. Similarly, unmount -f /MOUNT_POINT will force the filesystem to unmount.

    To unmount a FUSE filesystem, type fusermount -u MOUNTPOINT.

    A filesystem can be mounted in more than one location. To do so, first, mount the filesystem. Afterwards, a second mount-point can be made by executing mount -B /FIRST_MOUNT /SECOND_MNT which binds the second mount-point to the first. When accessing the filesystem from the second mount-point, it will seem as if that was the original mount-point.

    Mount-points can also be moved by running mount -M /OLD_MOUNT /NEW_MOUNT.

    Further Reading

Viewing 1 post (of 1 total)