12.6 总结与练习

、基本存储配置
1) 添加一块10G大小的磁盘,将该磁盘分为两个主分区,大小为1G、2G。将剩余的空间全部划分为扩展分
区。划分一个逻辑分区,大小为3G。(主分区文件系统类型为ext4,逻辑分区文件系统类型为xfs)

[root@server ~]# fdisk -l
Disk /dev/sda: 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: gpt
Disk identifier: 5CA9407D-063E-4946-89A8-BA6295CFB3C6
[root@server ~]# 

[root@server ~]# fdisk -l /dev/sda
Disk /dev/sda: 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: 0x389f9507

Device     Boot   Start      End  Sectors Size Id Type
/dev/sda1          2048  2099199  2097152   1G 83 Linux
/dev/sda2       2099200  6293503  4194304   2G 83 Linux
/dev/sda3       6293504 20971519 14678016   7G  5 Extended
/dev/sda5       6295552 12587007  6291456   3G 83 Linux

[root@server ~]# mkfs.ext4 /dev/sda1 
mke2fs 1.45.4 (23-Sep-2019)
Creating filesystem with 262144 4k blocks and 65536 inodes
Filesystem UUID: 6a08ada4-5928-4744-8d4c-259ce6db54a3
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

[root@server ~]# mkfs /dev/sda2
mke2fs 1.45.4 (23-Sep-2019)
Creating filesystem with 524288 4k blocks and 131072 inodes
Filesystem UUID: 607d65be-1cd7-4c91-bc24-951f478a6568
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912

Allocating group tables: done                            
Writing inode tables: done                            
Writing superblocks and filesystem accounting information: done 

[root@server ~]# mkfs.xfs /dev/sda5
meta-data=/dev/sda5              isize=512    agcount=4, agsize=196608 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=1, rmapbt=0
         =                       reflink=1
data     =                       bsize=4096   blocks=786432, 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

2) 将三个分区分别挂载到/dir1、/dir2、/dir3。

[root@server ~]# mount /dev/sda1 /dir1
[root@server ~]# mount /dev/sda2 /dir2
[root@server ~]# mount /dev/sda5 /dir3
[root@server ~]# df -hT
Filesystem     Type      Size  Used Avail Use% Mounted on
devtmpfs       devtmpfs  874M     0  874M   0% /dev
tmpfs          tmpfs     901M     0  901M   0% /dev/shm
tmpfs          tmpfs     901M  9.8M  891M   2% /run
tmpfs          tmpfs     901M     0  901M   0% /sys/fs/cgroup
/dev/nvme0n1p3 xfs        37G   11G   27G  29% /
/dev/nvme0n1p1 xfs       495M  214M  281M  44% /boot
tmpfs          tmpfs     181M  1.2M  179M   1% /run/user/42
tmpfs          tmpfs     181M  4.6M  176M   3% /run/user/0
/dev/sr0       iso9660   7.9G  7.9G     0 100% /run/media/root/RHEL-8-2-0-BaseOS-x86_64
/dev/sda1      ext4      976M  2.6M  907M   1% /dir1
/dev/sda2      ext2      2.0G  3.0M  1.9G   1% /dir2
/dev/sda5      xfs       3.0G   54M  3.0G   2% /dir3

3) 在第一个主分区中创建一个文件为file1,内容为this is partition1。在第二个分区中创建一个文
件为file2,内容为this is partition2。在第三个分区中创建一个文件为file3,内容为this is
partition3。

[root@server ~]# echo "this is partition1" > /dir1/file1
[root@server ~]# echo "this is partition2" > /dir2/file2
[root@server ~]# echo "this is partition3" > /dir3/file3
[root@server ~]# cat /dir1/file1
this is partition1
[root@server ~]# cat /dir2/file2
this is partition2
[root@server ~]# cat /dir3/file3
this is partition3
[root@server ~]# 


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值