10.磁盘存储和文件系统管理

Part 1

1、创建一个2G的文件系统,块大小为2048byte,预留1%可用空间,文件系统ext4,卷标为TEST,要求此分区开机后自动挂载至/test目录,且默认有acl挂载选项
[root@kezai ~]#scandisk
[root@kezai ~]#alias scandisk
alias scandisk='echo '\''- - -'\'' > /sys/class/scsi_host/host0/scan;echo '\''- - -'\'' > /sys/class/scsi_host/host1/scan;echo '\''- - -'\'' > /sys/class/scsi_host/host2/scan'
[root@kezai ~]#lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0  200G  0 disk 
├─sda1   8:1    0    1G  0 part /boot
├─sda2   8:2    0  100G  0 part /
├─sda3   8:3    0    2G  0 part [SWAP]
├─sda4   8:4    0    1K  0 part 
└─sda5   8:5    0   50G  0 part /data
sdb      8:16   0   20G  0 disk 
├─sdb1   8:17   0    1G  0 part 
├─sdb2   8:18   0    2G  0 part 
└─sdb3   8:19   0    1K  0 part 
sdc      8:32   0   10G  0 disk  # 新增加的磁盘
sr0     11:0    1  6.7G  0 rom  
[root@kezai ~]#fdisk /dev/sdc

Welcome to fdisk (util-linux 2.32.1).
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.
Created a new DOS disklabel with disk identifier 0x41eae9c9.

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 
First sector (2048-20971519, default 2048): 
Last sector, +sectors or +size{K,M,G,T,P} (2048-20971519, default 20971519): +2G

Created a new partition 1 of type 'Linux' and of size 2 GiB.

Command (m for help): p
Disk /dev/sdc: 10 GiB, 10737418240 bytes, 20971520 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
Disklabel type: dos
Disk identifier: 0x41eae9c9

Device     Boot Start     End Sectors Size Id Type
/dev/sdc1        2048 4196351 4194304   2G 83 Linux

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

[root@kezai ~]#lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0  200G  0 disk 
├─sda1   8:1    0    1G  0 part /boot
├─sda2   8:2    0  100G  0 part /
├─sda3   8:3    0    2G  0 part [SWAP]
├─sda4   8:4    0    1K  0 part 
└─sda5   8:5    0   50G  0 part /data
sdb      8:16   0   20G  0 disk 
├─sdb1   8:17   0    1G  0 part 
├─sdb2   8:18   0    2G  0 part 
└─sdb3   8:19   0    1K  0 part 
sdc      8:32   0   10G  0 disk 
└─sdc1   8:33   0    2G  0 part  #新建的分区
sr0     11:0    1  6.7G  0 rom  
[root@kezai ~]#mkfs.ext4 -b 2048 -m 1 -L TEST /dev/sdc1
#-b 2048 块大小为2048byte   -m 1  预留1%  -L TEST  卷标名为TEST
[root@kezai ~]#tune2fs -l /dev/sdc1
tune2fs 1.45.6 (20-Mar-2020)
Filesystem volume name:   TEST   #卷标名
Last mounted on:          <not available>
Filesystem UUID:          1ff433a7-cbd8-42b4-ad6d-eced5c8827fc
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype extent 64bit flex_bg sparse_super large_file huge_file dir_nlink extra_isize metadata_csum
Filesystem flags:         signed_directory_hash 
Default mount options:    user_xattr acl  #centos8 ext4文件系统,默认就有acl功能,不需要单独设置
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              131072
Block count:              1048576
Reserved block count:     10485  #预留块大小
Free blocks:              1011035
Free inodes:              131061
First block:              0
Block size:               2048  # 块大小为2048
Fragment size:            2048
Group descriptor size:    64
Reserved GDT blocks:      512
Blocks per group:         16384
Fragments per group:      16384
Inodes per group:         2048
Inode blocks per group:   256
Flex block group size:    16
Filesystem created:       Mon May 23 18:23:10 2022
Last mount time:          n/a
Last write time:          Mon May 23 18:23:10 2022
Mount count:              0
Maximum mount count:      -1
Last checked:             Mon May 23 18:23:10 2022
Check interval:           0 (<none>)
Lifetime writes:          1058 kB
Reserved blocks uid:      0 (user root) #预留块给root使用
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:	          256
Required extra isize:     32
Desired extra isize:      32
Journal inode:            8
Default directory hash:   half_md4
Directory Hash Seed:      1e350d41-6d95-41fd-9ab2-5699015f3491
Journal backup:           inode blocks
Checksum type:            crc32c
Checksum:                 0x6fb9bb85

[root@kezai ~]#mkdir /test  # 创建挂载目录
[root@kezai ~]#blkid /dev/sdc1 #查看uuid和文件类型
/dev/sdc1: PARTUUID="41eae9c9-01"
[root@kezai ~]#vim /etc/fstab 
/dev/sdc1: LABEL="TEST" UUID="1ff433a7-cbd8-42b4-ad6d-eced5c8827fc" TYPE="ext4" PARTUUID="41eae9c9-01"
[root@kezai ~]# mount -a #自动挂载
[root@kezai ~]# mount
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值