Linux新增一个磁盘,是需要挂载后,才能生效。
(以xfs为例)步骤如下:
1查看需要格式化的磁盘 # fdisk -l Disk /dev/vda: 536.9 GB, 536870912000 bytes, 1048576000 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x000a0687 Device Boot Start End Blocks Id System /dev/vda1 * 2048 1048575966 524286959+ 83 Linux Disk /dev/vdb: 1610.6 GB, 1610612736000 bytes, 3145728000 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes 2.格式化磁盘 # mkfs.xfs /dev/vdb 3.查看 /dev/vdb 的 UUID # blkid /dev/vda1: UUID="f5954a19-b069-42e4-a6ca-3a1cd06d0735" TYPE="ext4" /dev/vdb: UUID="95aaef18-ce4c-4f29-95ec-84ae431cdee0" TYPE="xfs" 注意 95aaef18-ce4c-4f29-95ec-84ae431cdee0 将在下面第五步用到 4.创建挂载目录: # mkdir /data 5.修改添加fstab文件 将3中查询的UUID 修改正确 vi /etc/fstab 将下一行添加到 fstab 文件末行 UUID=95aaef18-ce4c-4f29-95ec-84ae431cdee0 /data xfs defaults 0 0 ###查看fstab [root@ecspg-0001 ~]# cat /etc/fstab # /etc/fstab # Created by anaconda on Thu Feb 10 06:16:21 2022 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # UUID=f5954a19-b069-42e4-a6ca-3a1cd06d0735 / ext4 defaults 1 1 UUID=95aaef18-ce4c-4f29-95ec-84ae431cdee0 /data xfs defaults 0 0 6.执行挂载命令: [root@ecspg-0001 ~]# mount -a [root@ecspg-0001 ~]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 7.8G 0 7.8G 0% /dev tmpfs 7.8G 0 7.8G 0% /dev/shm tmpfs 7.8G 8.6M 7.8G 1% /run tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup /dev/vda1 493G 2.8G 469G 1% / tmpfs 1.6G 0 1.6G 0% /run/use /dev/vdb 200G 33M 1600G 1% /data |