blue第五题【创建卷组和逻辑卷】

一、题目要求

创建一个 VG 名字 wgroup 和 LV 名字为wsharePE(物理存储单元)大小 8M LV 中PE 个数 100 ,自动挂载到/mnt/wshare 格式为ext4

二、解题过程

1、新建逻辑分区

[root@blue ~]# fdisk /dev/vdc

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.


Command (m for help): n
All space for primary partitions is in use.
Adding logical partition 6
First sector (5249024-10485759, default 5249024): 
Last sector, +sectors or +size{K,M,G,T,P} (5249024-10485759, default 10485759): +1G

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

Command (m for help): t
Partition number (1,2,5,6, default 6): 
Hex code (type L to list all codes): 8e

Changed type of partition 'Linux' to 'Linux LVM'.

Command (m for help): p
Disk /dev/vdc: 5 GiB, 5368709120 bytes, 10485760 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: 0x9abafb02

Device     Boot   Start      End Sectors  Size Id Type
/dev/vdc1          2048  4196351 4194304    2G 8e Linux LVM
/dev/vdc2       4196352 10485759 6289408    3G  5 Extended
/dev/vdc5       4198400  5246975 1048576  512M 82 Linux swap / Solaris
/dev/vdc6       5249024  7346175 2097152    1G 8e Linux LVM

Command (m for help): w
The partition table has been altered.
Syncing disks.

[root@blue ~]# 

2、创建卷组
使用vd6创建物理卷

[root@blue ~]# pvcreate /dev/vdc6
  Physical volume "/dev/vdc6" successfully created.
[root@blue ~]#

创建卷组

[root@blue ~]# vgcreate -s 8M wgroup /dev/vdc6 
  Volume group "wgroup" successfully created
[root@blue ~]# vgs
  VG     #PV #LV #SN Attr   VSize    VFree   
  vol      1   1   0 wz--n-   <2.00g    1.78g
  wgroup   1   0   0 wz--n- 1016.00m 1016.00m
[root@blue ~]#

3、创建逻辑卷

[root@blue ~]# lvcreate -l 100 -n wshare wgroup
  Logical volume "wshare" created.
[root@blue ~]# lvs
  LV     VG     Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  vo     vol    -wi-ao---- 220.00m                                                    
  wshare wgroup -wi-a----- 800.00m                                                    
[root@blue ~]#

4、格式化为ext4

[root@blue ~]# mkfs.ext4 /dev/wgroup/wshare 
mke2fs 1.45.6 (20-Mar-2020)
Creating filesystem with 204800 4k blocks and 51296 inodes
Filesystem UUID: 3a29b72a-f991-40d1-abbd-997eb640a41c
Superblock backups stored on blocks: 
	32768, 98304, 163840

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

[root@blue ~]# 

5、自动挂载
新建挂载点

[root@blue ~]# mkdir /mnt/wshare

6、实现自动挂载

[root@blue ~]# vim /etc/fstab 
[root@blue ~]# tail -1 /etc/fstab 
/dev/wgroup/wshare	/mnt/wshare	ext4	defaults	0 0 
[root@blue ~]# 

7、验证自动挂载

[root@blue ~]# mount -a
[root@blue ~]# df -Th
Filesystem                Type      Size  Used Avail Use% Mounted on
devtmpfs                  devtmpfs  869M     0  869M   0% /dev
tmpfs                     tmpfs     909M     0  909M   0% /dev/shm
tmpfs                     tmpfs     909M  544K  908M   1% /run
tmpfs                     tmpfs     909M     0  909M   0% /sys/fs/cgroup
/dev/vda1                 xfs        10G  3.2G  6.9G  32% /
/dev/mapper/vol-vo        xfs       215M   14M  202M   7% /vo
tmpfs                     tmpfs     182M     0  182M   0% /run/user/1000
tmpfs                     tmpfs     182M     0  182M   0% /run/user/0
/dev/mapper/wgroup-wshare ext4      772M  1.6M  714M   1% /mnt/wshare
[root@blue ~]#
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值