We are using the cd-rom image source reasonably
[root@centos7 ~]# mount /dev/sr0/mnt mount: /dev/sr0 is write-protected, mounts Read-only
[root@centos7 ~]# cat /etc/yom.repos. D/centos-local. repo [Local] name=Local baseurl=file:///mnt gpgcheck=0 enable=1
[root@centos7 ~]# yum repolist Loaded plugins: fastestmirror, langpacks Determining fastest mirrors
- base: ftp.sjtu.edu.cn
- extras: ftp.sjtu.edu.cn
- updates: mirrors.aliyun.com
The Local | 3.6 kB 00:00:00 base | 3.6 kB 00:00:00 extras | 2.9 kB 00:00:00 updates | 2.9 kB 00:00:00 (1/6) : Local/group_gz | 153 kB 00:00:00 (2/6) : Local/primary_db | 3.3 MB 00:00:00 (3/6) : 7 / x86_64 / base/group_gz | 153 kB 00:00:00 (4/6) : 7 / x86_64 / updates/primary_db | 7.1 MB 00:00:01 (5/6) : extras/7/x86_64/primary_db | 232 kB 00:00:02 (6/6): Base/seven/x86_64 / primary_db | 6.1 MB 00:00:03 ‘id’ name status Local Local 4071 base/July/x86_64 CentOS – 7 – base 072 extras/7/x86_64 centos-7 – extras 468 updates/7/x86_64 centos-7 – updates 1,924
So: we can see that a source named local is actually what’s in our disc image
2. The logical volume is mounted in an independent space of the LV and can be expanded online. To avoid data loss or back up data in the volume, do not shrink the volume
[root@centos7 ~]#fdisk /dev/sdb [root@centos7 ~]#partprobe [root@centos7 ~]#pvcreate /dev/sdb1 [root@centos7 ~]#vgcreate VolGroup /dev/sdb1 [root@centos7 ~]# VGS [root@centos7 ~]# lvcreate -l 1G -n data_lv VolGroup Logical volume “data_lv” created. [root@centos7 ~]# mkfs. XFS /dev/volgroup/data_lv Meta -data=/dev/VolGroup/data_lv isize=512 agcount=4, agsize=65536 BLKS = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=0, sparse=0 data = bsize=4096 blocks=262144, 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
[root@centos7 ~]# vi /etc/fstab /dev/mapper/volgroup-data_lv /data XFS defaults 0 0 [root@centos7 ~] mount -av