创建一个2G的文件系统,块大小为2048byte,预留1%可用空间,文件系统 ext4,卷标为TEST,要求此分区开机后自动挂载至/test目录,且默认有acl挂载选项

虚拟机测试

在vmware添加一块新的硬盘,一路默认就可以

 

新添加的硬盘使用lsblk查看的时候是显示不了的。需要刷新硬盘

echo '- - -' > /sys/class/scsi_host/host2/scan

如果执行命令之后还是不显示,就将host2更换成host0,再次查看应该就会有的。

 

sdb就是新硬盘

接下来是分区

 

 

[root@centos7 ~]# mke2fs -t ext4 -b 2048 -L 'TEST' -m 1 /dev/sdb1    #创建文件系统。-t ext4指定文件系统类型。-b 2048指定块大小。-L 'TEST'指定卷标。-m 1 指定预留空间
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=TEST
OS type: Linux
Block size=2048 (log=1)
Fragment size=2048 (log=1)
Stride=0 blocks, Stripe width=0 blocks
131072 inodes, 1048576 blocks
10485 blocks (1.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=269484032
64 block groups
16384 blocks per group, 16384 fragments per group
2048 inodes per group
Superblock backups stored on blocks: 
    16384, 49152, 81920, 114688, 147456, 409600, 442368, 802816

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
[root@centos7 ~]# blkid   #查看块设备信息
/dev/sr0: UUID="2018-06-29-11-20-20-00" LABEL="CentOS_6.10_Final" TYPE="iso9660" PTTYPE="dos" 
/dev/sda1: UUID="585809d8-9425-4b98-808c-13185cda544d" TYPE="xfs" 
/dev/sda2: UUID="6402df05-79cd-45b2-a5d0-87d105f4fffe" TYPE="xfs" 
/dev/sda3: UUID="583ce223-536a-448c-bfd9-3bf13ccb9d8f" TYPE="xfs" 
/dev/sda5: UUID="7780205e-63f7-4b7d-b53b-b8b0ea72b764" TYPE="swap" 
/dev/sr1: UUID="2018-11-26-14-22-58-00" LABEL="CentOS 7 x86_64" TYPE="iso9660" PTTYPE="dos" 
/dev/sdb1: LABEL="TEST" UUID="f81dc5d3-6a64-4547-bf7e-5c010702c457" TYPE="ext4"

创建挂载点并挂载

[root@centos7 ~]# mkdir /mnt/sdb1
[root@centos7 ~]# mount /dev/sdb1 /mnt/sdb1/

将sdb1写入文件,以达到永久挂载,开机自动挂载

[root@centos7 ~]# vim /etc/fstab 


#
# /etc/fstab
# Created by anaconda on Sat Jun  6 09:37:40 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=6402df05-79cd-45b2-a5d0-87d105f4fffe /                       xfs     defaults        0 0
UUID=585809d8-9425-4b98-808c-13185cda544d /boot                   xfs     defaults        0 0
UUID=583ce223-536a-448c-bfd9-3bf13ccb9d8f /data                   xfs     defaults        0 0
UUID=7780205e-63f7-4b7d-b53b-b8b0ea72b764 swap                    swap    defaults        0 0
UUID=f81dc5d3-6a64-4547-bf7e-5c010702c457 /mnt/sdb1               ext4    defaults        0 0       #这个uuid就是上边blkid中查看到的

重启验证

 

 开机已自动挂载

 

posted @ 2020-07-28 09:54  树在地上  阅读(356)  评论(0编辑  收藏  举报