磁盘格式化挂载

磁盘格式化并挂载

关闭虚拟机,添加一块10G的磁盘

查看磁盘情况

[zbiti@hadoop106 ~]$ sudo fdisk -l

磁盘 /dev/sdb:10.7 GB, 10737418240 字节,20971520 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节


磁盘 /dev/sda:21.5 GB, 21474836480 字节,41943040 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x000b2a75

   设备 Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      411647      204800   83  Linux
/dev/sda2          411648     4605951     2097152   82  Linux swap / Solaris
/dev/sda3         4605952    41943039    18668544   83  Linux

格式化磁盘

[zbiti@hadoop106 ~]$ sudo mkfs.xfs /dev/sdb 
meta-data=/dev/sdb               isize=512    agcount=4, agsize=655360 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0, sparse=0
data     =                       bsize=4096   blocks=2621440, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

创建磁盘挂载目录

[zbiti@hadoop106 ~]$ sudo mkdir /data

查看磁盘/dev/sdbUUID

[zbiti@hadoop106 ~]$ sudo blkid
/dev/sdb: UUID="29a744b2-cc5b-47de-ab76-a6a43867758f" TYPE="xfs" 
/dev/sda1: UUID="7287d13b-3676-4838-9553-8278ba31d3d7" TYPE="xfs" 
/dev/sda2: UUID="e8303617-9eaa-4f63-9c17-696f0cff2b7a" TYPE="swap" 
/dev/sda3: UUID="8506ea54-f42c-4451-bf16-2d46b530a3df" TYPE="xfs" 
/dev/sr0: UUID="2019-09-11-18-50-31-00" LABEL="CentOS 7 x86_64" TYPE="iso9660" PTTYPE="dos" 

修改配置文件

在末尾追加/dev/sdbUUID,让系统启动的时候进行挂载

[zbiti@hadoop106 ~]$ sudo vim /etc/fstab 


#
# /etc/fstab
# Created by anaconda on Tue Jan  7 17:07:35 2020
#
# 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=8506ea54-f42c-4451-bf16-2d46b530a3df /                       xfs     defaults        0 0
UUID=7287d13b-3676-4838-9553-8278ba31d3d7 /boot                   xfs     defaults        0 0
UUID=e8303617-9eaa-4f63-9c17-696f0cff2b7a swap                    swap    defaults        0 0
UUID=29a744b2-cc5b-47de-ab76-a6a43867758f       /data   xfs     defaults 0      0

立即挂载

[zbiti@hadoop106 ~]$ sudo mount -a
[zbiti@hadoop106 ~]$ df -h
文件系统        容量  已用  可用 已用% 挂载点
devtmpfs        975M     0  975M    0% /dev
tmpfs           991M     0  991M    0% /dev/shm
tmpfs           991M   11M  980M    2% /run
tmpfs           991M     0  991M    0% /sys/fs/cgroup
/dev/sda3        18G  6.5G   12G   37% /
/dev/sda1       197M  146M   51M   75% /boot
tmpfs           199M   12K  199M    1% /run/user/42
tmpfs           199M     0  199M    0% /run/user/1000
/dev/sdb         10G   33M   10G    1% /data

 本篇
磁盘格式化挂载 磁盘格式化挂载
磁盘格式化并挂载关闭虚拟机,添加一块10G的磁盘 查看磁盘情况[zbiti@hadoop106 ~]$ sudo fdisk -l 磁盘 /dev/sdb:10.7 GB, 10737418240 字节,20971520 个扇区 Unit
2020-01-08
下一篇 
shell shell
Shell 解析器查看系统的解析器 [root@izm5eac6bnsz8uq175jkvez tmp]# cat /etc/shells /bin/sh /bin/bash /usr/bin/sh /usr/bin/bash [root
2019-12-17
  目录