# Cheat Sheet #day68 - mount

### `mount` Command Cheatsheet

The `mount` command in Unix-like systems is used to mount filesystems and network shares onto the directory tree. It is essential for managing storage devices and network shares efficiently. Here’s a quick reference guide:

#### Basic Syntax

```sh
mount [OPTION]... [DEVICE] [DIRECTORY]
```

#### Common Options

* `-t TYPE`, `--types TYPE`: Specify the filesystem type (e.g., ext4, nfs).
    
    ```sh
    mount -t ext4 /dev/sdb1 /mnt/data
    ```
    
* `-o OPTIONS`, `--options OPTIONS`: Mount options (e.g., `rw` for read-write, `ro` for read-only).
    
    ```sh
    mount -o rw /dev/sdb1 /mnt/data
    ```
    
* `-a`, `--all`: Mount all filesystems listed in `/etc/fstab` (except `noauto` entries).
    
    ```sh
    mount -a
    ```
    
* `-r`, `--read-only`: Mount the filesystem read-only.
    
    ```sh
    mount -o ro /dev/sdb1 /mnt/data
    ```
    
* `-v`, `--verbose`: Verbose mode, print detailed information during the mount operation.
    
    ```sh
    mount -v /dev/sdb1 /mnt/data
    ```
    

#### Examples

1. **Mount a device to a directory:**
    
    ```sh
    mount /dev/sdb1 /mnt/data
    ```
    
2. **Mount a filesystem specifying type and options:**
    
    ```sh
    mount -t ext4 -o rw /dev/sdb1 /mnt/data
    ```
    
3. **Mount all filesystems listed in** `/etc/fstab`:
    
    ```sh
    mount -a
    ```
    
4. **Mount a remote NFS share:**
    
    ```sh
    mount -t nfs server:/share /mnt/nfs
    ```
    
5. **Unmount a mounted filesystem:**
    
    ```sh
    umount /mnt/data
    ```
    

#### Additional Information

* **List mounted filesystems:**
    
    ```sh
    mount
    ```
    
* **Help option:**
    
    ```sh
    mount --help
    ```
    
* **View manual page for** `mount`:
    
    ```sh
    man mount
    ```
    

The `mount` command is crucial for managing filesystems and network shares in Unix-like systems. It allows administrators to control storage devices and network resources effectively. For more detailed options and usage scenarios, refer to the `man` page or use `mount --help`.
