查看磁盘挂载情况

df -h

查看所有磁盘

fdisk -l

磁盘分区(1个)

fdisk /dev/sdb
[root@localhost mnt]# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xd14e90a4.

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-209715199, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-209715199, default 209715199): 
Using default value 209715199
Partition 1 of type Linux and of size 100 GiB is set

Command (m for help): wq
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

格式化分区

mkfs.ext4 /dev/sdb

建立挂载目录

mkdir /mnt/datadisk

挂载硬盘

mount /dev/sdb /mnt/datadisk

设置开机自动挂载

vi /etc/fstab

/dev/sdb /mnt/datadisk ext4 defaults 0 0

重启验证reboot

df -h
文章作者: 正焕
版权声明: 本站所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 海边的曼切斯特
喜欢就支持一下吧