Linux挂载硬盘教程(Steps to mount a partition in Linux)

vps · 今天 · 25 人浏览

这鬼天气!前几天气温都快升到30℃,要穿短袖了,结果今天降温,下起了鹅毛大雪!!

春节最后一天,待在家里出不去,打算把Nextcloud重装下,用的是GreecloudVPS,需要挂载1T的硬盘,记录下过程。

  1. To check the mounted partitions, use the command
df -h
  1. List the partitions using the fdisk -l commands to identify the hard drive you want to mount.
fdisk -l

Looking at the output in the screenshot above, we have two hard disks added to the test system and we will mount the disk. /dev/vdb

To determine the filesystem type of the disk or partition.

blkid /dev/vdb
  1. Create a data folder to mount /dev/vdb into
mkdir -p /data
  1. Format disk /dev/vdb in ext4
mkfs.ext4 /dev/vdb

If you want to use XFS, run: mkfs.xfs /dev/vdb

  1. Add to fstab file to automatically mount the system when reboot
echo '/dev/vdb /data ext4 defaults 0 0' >> /etc/fstab

Or xfs:

echo '/dev/vdb /data xfs defaults 0 0' >> /etc/fstab
  1. Apply the changes by mounting all filesystems.
mount -a
  1. Confirm the disk or partition is mounted.
df -h

我也就不翻译了,很简单。

vps nextcloud
Theme Jasmine by Kent Liao