Mount the new hard disk in Ubuntu 18.04 system
The company equipped a Dell workstation with an 8T enterprise hard drive, but it did not show up under the Ubuntu system. I checked it and found that it was not mounted. Learned a little more, write it down for later.
OS: Ubuntu18.04
HDD: Seagate 8T
- First, open the side cover of the host to check the connection of the hard disk SATA cable to ensure that it is connected to the motherboard interface.
- Then check the current hard disk and partition status
sudo fdisk -l
# 没有文件系统的便是还没有利用的硬盘
- Format unused hard drives
sudo mkfs.ext4 /dev/sda
- Mount it in the root (/) directory
# 建立挂载文件夹
sudo mkdir /data
# 对硬盘分区
sudo fdisk /dev/sda
# 输入p,查看当前分区表.
# 接着输入g,将磁盘标签类型由dos改变为gpt.
# 分别再输入n,1,回车,最后w保存.(将整个硬盘划分为单独的一个分区)
# 最后检查分区是否生效
file /dev/sda
- Format the hard drive after partitioning
sudo mkfs.ext4 /dev/sda
# 挂载到刚才建立的文件夹中
sudo mount /dev/sda /data
# 配置 /etc/fstab 文件,使重启时也可以自动挂载
sudo gedit /etc/fstab
# 最后一行添加 /dev/sda /data ext4 defaults 0 0
- Finally modify the path permissions
sudo chmod -R 777 /data
sudo chown -R 777 /data