--- title: mount โ€” Attach a filesystem date: 2026-10-18 time: 12:00 model: admin category: programs author_type: human summary: Command that attaches disks or network shares to a specific path and checks their status. tags: program, File and disk management, mount --- **๐Ÿ’ฌ "mount command"** mount connects a device or network share **to a directory**. The connection point is called a mount point. It is also often used to view the current mount status. - **Concept**: Connects a device (or remote share) to a directory. - **Left argument**: A device path (e.g., /dev/vdc1) or a remote share (e.g., 10.0.0.5:/data). - **Right argument**: The directory to connect to (mount point). - **View status**: Running without arguments shows the current mount list. ## Commonly used options | Option | Description | | --- | --- | | -t | Specifies the filesystem type (ext4, nfs, xfs, etc.) | | -o | Specifies options (ro, noatime, noexec, etc.) | | -a | Mounts all entries defined in /etc/fstab | | --bind | Exposes an existing directory at another path as-is | ## 3 essential command combinations - `mount | column -t | head` โ€” Check the current mount status in column-aligned format - `mount -o noexec,nosuid /dev/vdc1 /data` โ€” Mount with security options - `mount --bind /srv/app/public /var/www/html` โ€” Connect a directory to the web root **๐Ÿ’ฌ "Show me how to find bottlenecks with this command"** Here are common situations on production servers, organized in order. ### Step 1 ยท Check the device Check the device and filesystem to mount. ``` lsblk -f /dev/vdc ``` ### Step 2 ยท Prepare the mount point and connect Create an empty directory and mount. ``` mkdir -p /data && mount /dev/vdc1 /data ``` ### Step 3 ยท Persist after reboot Add it to fstab and test. ``` grep /data /etc/fstab && mount -a ``` ## In practice, it is used like this ### 1. Attaching a new data disk **Situation** โ€” You want to use a 500G volume as /data. ``` mkfs.ext4 /dev/vdc1 && mkdir -p /data && mount /dev/vdc1 /data ``` **Result** โ€” When you enter /data, you see the contents of the new volume. **Tip** โ€” Formatting a device that has existing data makes recovery difficult. Check the device first with lsblk. ### 2. Exposing a deployment directory **Situation** โ€” The app uses /srv/app/public, but the web server root is /var/www/html. ``` mount --bind /srv/app/public /var/www/html ``` **Result** โ€” The same content is visible at both paths without copying. **Tip** โ€” Bind mounts disappear on reboot, so add them to fstab or consider a symbolic link as well. ## Cautionary notes - If you mount over a directory that already has files, those contents are hidden (not deleted). They can be recovered if needed. - Incorrect fstab syntax can lead to boot failure. After editing, verify with mount -a. - Network filesystems can hang on access during a network failure, so set timeout options. - Formatting (mkfs) erases data. Never run it without confirming the device name. ## Actual execution screen This is the result of checking the currently mounted filesystems and options. ![mount command execution result: mount list and options](https://games.aidebatehub.com/assets/mount-demo.png) Production server --- Source (HTML): https://games.aidebatehub.com/programs/linux/filesystem/mount.html This file is an auto-generated Markdown twin of the DevHub document.