What is the command to mount a hard drive on Linux?

The command to mount a hard drive on Linux is `mount`. Here are some common usages:

View all available disks and partitions.

$ sudo fdisk -l

This will list all the available disks and partitions in the system.

2. Establishing a mounting point

To mount a hard drive, you first need to create a directory as the mount point. You can choose any empty directory as the mount point. For example, we can create a mount point named ‘mydisk’ under the `/mnt` directory.

$ sudo mkdir /mnt/mydisk

mounting a hard drive

To mount a hard drive, use the `mount` command. The syntax is as follows:

$ sudo mount /dev/<设备名称> /mnt/<挂载点>

In this case, `` refers to the path of the hard disk device (e.g. `/dev/sdb1`), and `` is the path of the previously created mounting point.

For example, to mount `/dev/sdb1` to `/mnt/mydisk`:

$ sudo mount /dev/sdb1 /mnt/mydisk

Uninstall the hard drive.

After use, you can unmount the hard drive using the `umount` command. The syntax is as follows:

$ sudo umount /mnt/<挂载点>

For example, to uninstall `/mnt/mydisk`:

$ sudo umount /mnt/mydisk

Please make sure no processes are using any files under the mount point before uninstalling.

广告
Closing in 10 seconds
bannerAds