1. 使用fdisk查看硬盘信息

    fdisk -l
  2. 格式化硬盘

    sudo mkfs.ext4 /dev/sdX
  3. 创建要挂载的目录

    sudo mkdir /mnt/mydrive
  4. 赋予目录权限

    chmod -R 777 /mnt/mydrive
  5. 挂载硬盘

    sudo mount /dev/sdX1 /mnt/mydrive
  6. 开机自动挂载硬盘

    nano /etc/fstab
    /dev/sdX1  /mnt/mydrive  ext4  defaults  0  2
  7. 或使用UUID挂载

    lsblk -o NAME,UUID
    UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX  /mnt/mydrive  ext4  defaults  0  2
  8. 卸载硬盘

    sudo umount /mnt/mydrive