In Linux, the mount command is used to attach (or mount) a file system (a storage device eg. USB flash drive or hard disk) to a specified directory(eg. /usr/local) in the file system hierarchy.
This makes the files and directories of the mounted device accessible to the user and the system.
The mountpoint is always a absolute path. You can use subdirectories.
/mnt/ | Used as universal mountpoint |
---|---|
/net/ | Used for mounting nfs and cifs shares |
/media/ | Used for USB, CD or DVD drives |
If you want add directories to net or media.
Replace ext4 with the actual filesystem type if different.
# mount -t ext4 /dev/sdb1 /mnt
# mount -t iso9660 -o ro /dev/<device-name> /media
You first need to known the device name the USB-drive has. Then mount the partition on it.
# fdisk -l ..... Disk /dev/sdc: 3.76 GiB, 4037017600 bytes, 7884800 sectors Disk model: Flash Disk Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: gpt Disk identifier: 0B6DDFBE-E9D1-4D49-8375-66648E5F1B30 Device Start End Sectors Size Type /dev/sdc1 128 7880831 7880704 3.8G Microsoft basic data # mount /dev/sdc1 /mnt
# mount -t msdos /dev/fd0 /mnt/
To allow users other than root to mount and unmount devices you need to edit as root the lines in /etc/fstab corresponding to floppy and CD-ROM, respectively, to look like the following:
/dev/fd0 /mnt/floppy auto user,defaults,noauto 0 0 /dev/cdrom /mnt/cdrom auto user,ro,defaults,noauto 0 0
# mount -t nfs 192.168.1.15:/share /mnt
Server Message Block (SMB) is a communication protocol used to share files, printers, serial ports, and miscellaneous communications between nodes on a network. On Microsoft Windows, the SMB implementation consists of two vaguely named Windows services: "Server" (ID: LanmanServer) and "Workstation" (ID: LanmanWorkstation). It uses NTLM or Kerberos protocols for user authentication. It also provides an authenticated inter-process communication (IPC) mechanism.
Use the username for the shamba share and its password.
# mount -t cifs -o username=smbuser,password=Pas$W0rd //192.168.1.15/public /mnt
When you want the mount released use:
# umount /mnt