? Configure the server's Yum repository
[Email protected] ~]# rm-rf/etc/yum.repos.d/*
[Email protected] ~]# Vim/etc/yum.repos.d/dvd.repo
[DVD]
Name=dvd
baseurl=http://172.25.254.254/content/rhel7.0/x86_64/dvd/
Enabled=1
Gpgcheck=0
[email protected] ~]# yum clean all?? #清空缓存
[email protected] ~]# yum repolist??? #查看仓库信息
####################################################
Operations on the real machine:
[[Email protected] Desktop]# which rht-vmctl?
/usr/local/bin/rht-vmctl
[[Email protected] Desktop]# crontab-e-u root
[[Email protected] Desktop]# crontab-l-u root
8 * * *?/USR/LOCAL/BIN/RHT-VMCTL Reset Classroom
8 * * *?/USR/LOCAL/BIN/RHT-VMCTL Reset Server
8 * * *?/usr/local/bin/rht-vmctl Reset Desktop
#####################################################
? Add:? Vim? Command mode? YY can copy the current line where the cursor is located
????????????? p Paste
#####################################################
Tracks: Track
Sector: Sector?? 512 bytes
Head: Head
Cylinder: Cylinder
"Art" tour of a hard drive
? Identify the hard disk and partition Plan = + format and mount using
? Mbr/msdos partition mode
–1~4 primary partition, or 0~3 primary partition + one extended partition (n
Logical partitions)
– Maximum supported disks with a capacity of 2.2TB
– Extended partitions cannot be formatted
First, check that there are currently those disks
[Email protected] ~]# ls/dev/vd*
[Email protected] ~]# lsblk?
Ii. Division of partitions
? View Partition Table
[Email protected] ~]# fdisk-l/DEV/SDA
[Email protected] ~]# FDISK/DEV/VDB
Common Interactive directives:
M list instructions Help
P View the existing partition table
N New Partition
D Delete Partition
Q Discard Changes and exit
W Save changes and exit
# fdisk?/dev/vdb
? ? ? ? ? ? ? ? ?
?? n Create a new partition-----> Enter-----> enter----> enter-----> at the end of the last +1g
?? P View Partition Table
?? d Delete a partition
?? q do not save exit
?? w Save and exit
# ls?/dev/vdb[1-3]
# lsblk---------See if/dev/vd*
Third, the format of
? MKFS Tool Set
–MKFS.EXT3 Partition Device Path
–MKFS.EXT4 Partition Device Path
–MKFS.XFS Partition Device Path
–MKFS.VFAT-F 32 Partition Device path
[Email protected] ~]# MKFS.EXT3/DEV/VDB1
[[email protected] ~]# mkfs.ext4/dev/vdb2 (common Ext4)
[Email protected] ~]# MKFS.XFS/DEV/VDB3
? Iv. Mounting Use
[Email protected] ~]# Mkdir/part1
[Email protected] ~]# Mkdir/part2
[Email protected] ~]# MKDIR/PART3
[Email protected] ~]# mount/dev/vdb1?/part1
[Email protected] ~]# mount/dev/vdb2?/part2
[Email protected] ~]# mount/dev/vdb3?/part3
? v. View Mount Usage
[[email protected] ~]# DF-H (DF-HT)-----See full information
[Email protected] ~]# #mount/dev/vdb1?/mnt
[Email protected] ~]# #cp-r/home/*?/mnt/
[Email protected] ~]# #rm-rf/home/*
[Email protected] ~]# #umount/mnt/
[Email protected] ~]# #mount/dev/vdb1/home
# fdisk?/dev/vdb
?? P view partition table?????????
?? n Create a new partition
? ? ? -----> Enter----> Start Enter-----> End Carriage Return all space to the extended partition
?? P View Partition Table
?? n Create a new partition-----> Start Carriage------> End +1g
?? n Create a new partition-----> Start Carriage------> End +1g
?? P View Partition Table
?? w Save and exit
[Email protected] ~]# ls/dev/vdb*
[[email protected] ~]# partprobe???? #刷新分区表
[Email protected] ~]# ls/dev/vdb*
[Email protected] ~]# lsblk
####################################################
Boot auto mount?/etc/fstab
?? – Device Path????????????????? Backup tag?? Detection sequence
? /DEV/VDB3/part3 xfs? defaults?? 0??? 0
? /dev/vdb2/part2? ext4? Defaults?? 0??? 0
Add: Blkid? View partition UUID? file system
?? – Device Path????????????????? Backup tag?? Detection sequence
[Email protected] ~]# Vim/etc/fstab?
[Email protected] ~]# Tail-2/etc/fstab
?/dev/vdb3??/part3? Xfs?? defaults? 0 0
?/dev/vdb2??/part2? Ext4? Defaults? 0 0
[email protected] ~]# mount?-A
Detect/etc/fstab Boot automatically mount profile, format is correct
Detects/etc/fstab, writes complete, but does not currently mount the device, mounts
[[email protected] ~]# DF?-H
#####################################################
Summarize:
? 1. Lsblk??? view hard disk information
? 2. Fdisk??? partition
? 3. Partprobe? Refreshing a new partition table
? 4. Mkfs.xfs? formatting partitions
? 5. Mount??? load test
? 6. /etc/fstab Boot Auto Mount
###################################################
Divide/dev/vdc[1-3] Primary partition 10G, partition extended partition, divide two logical partition 10G
# fdisk?/dev/vdc
?? P view partition table??
?? n Create a new partition
? ? ? ------> Return---> Enter---> Carriage return---> +10g at the end of last?
? ??
?? n Create a new partition
? ? ? -----> Enter----> Start Enter-----> End Carriage Return all space to the extended partition
?? P View Partition Table
?? n Create a new partition-----> Start Carriage------> End +10g
?? P View Partition Table
?? w Save and exit
# Ls/dev/vdc[1-6]
##################################################
? LVM logical Volumes
? 1. Managing Scattered spaces
? 2. Extended domain reduction for logical volume dynamics
??
? A number of physical volumes (PV) are first formed into a volume group (VG), in which logical volumes (LVS) are divided from the volume group
?
?? flour---------> Dough-------> Small dough------> steaming-------> Use
?? brick------------> Floor----------> Partition--------> Decoration------> Use
##################################################
First, create physical volumes and volume groups
?? vgcreate? Volume group name?? partition
[Email protected] ~]# vgcreate MYVG?/dev/vdc[1-2]
[Email protected] ~]# PVs? #显示物理卷基本信息
[Email protected] ~]# VGS? #显示卷组基本信息
Ii. Creating a logical volume
? Lvcreate. l? Logical volume size?-n The name of the logical volume? Volume Group name
[Email protected] ~]# VGS
[Email protected] ~]# lvcreate-l 16g-n mylv MYVG
[Email protected] ~]# VGS
[[email protected] ~]# LVS (lvdisplay)----View instructions for logical volumes
Third, use the logical volume LV
[Email protected] ~]# MKFS.EXT4/DEV/MYVG/MYLV-----Formatted partition
[Email protected] ~]# MKDIR/LVM
[Email protected] ~]# Vim/etc/fstab?
/dev/myvg/mylv? /LVM? Ext4? Defaults 0 0
[email protected] ~]#? mount-a
[email protected] ~]#? df-h
###################################################
? Logical volume expansion, support for on-line operation
One, the volume group has enough space left
? 1. Space for direct expansion of logical volumes
[Email protected] ~]# VGS
[[email protected] ~]# LVS
[Email protected] ~]# lvextend-l 18G/DEV/MYVG/MYLV
[Email protected] ~]# LVs???????????????????????????????
[Email protected] ~]# VGS
? 2. Size of the extended file system
??
?? extension Ext4 file system?: RESIZE2FS/DEV/MYVG/MYLV
?? extended XFS File system?: XFS_GROWFS/DEV/MYVG/MYLV
[Email protected] ~]# df-h
[Email protected] ~]# RESIZE2FS/DEV/MYVG/MYLV
[Email protected] ~]# df-h
Second, the volume group does not have enough space left
? 1. Expand the volume group first
[Email protected] ~]# VGS
[[email protected] ~]# LVS
[Email protected] ~]# vgextend MYVG/DEV/VDC3
[Email protected] ~]# VGS
2. Directly extend the space of the logical volume
[Email protected] ~]# VGS
[[email protected] ~]# LVS
[Email protected] ~]# lvextend-l 25G/DEV/MYVG/MYLV
[Email protected] ~]# LVs???????????????????????????????
[Email protected] ~]# VGS
3. Size of the extended file system
[Email protected] ~]# df-h
[Email protected] ~]# RESIZE2FS/DEV/MYVG/MYLV
[Email protected] ~]# df-h
####################################################
Set PE size when creating a volume group
–vgcreate-s pe size? Volume group name? Free partition ...
? PE: Unit of volume Group dividing space, 4M
? The number of lvcreate-l PE?-n test? Volume Group name
[Email protected] ~]# vgchange-s 1M MYVG
[Email protected] ~]# vgdisplay MYVG?
[Email protected] ~]# lvcreate-l 50-n test? myvg
[[email protected] ~]# LVS
################################################### ?
Managing Swap Space
? Equivalent to virtual memory,
– Use disk space to simulate memory when physical memory is not sufficient
– To some extent alleviate the problem of low memory
– Swap partition: Swap space acting as an idle partition
[Email protected] ~]# MKSWAP/DEV/VDC5? #格式化SWAP命令
[Email protected] ~]# swapon-s????? #查看SWAP状态
[Email protected] ~]# SWAPON/DEV/VDC5? #启用交换空间
[Email protected] ~]# swapon-s???????
[Email protected] ~]# MKSWAP/DEV/VDC6
[Email protected] ~]# SWAPON/DEV/VDC6
[Email protected] ~]# swapon-s
[Email protected] ~]# SWAPOFF/DEV/VDC5? #停用交换空间
[Email protected] ~]# swapon-s
[Email protected] ~]# swapoff/dev/vdc6? #停用交换空间
[Email protected] ~]# swapon-s
#############################################
? Add: Vim command mode? Press O to insert another line
?? auto mount on Boot
[Email protected] ~]# Vim/etc/fstab?
/dev/vdc5???? Swap swap? Defaults? 0 0
[[email protected] ~]# swapon-a?? #专用于检测swap分区
[Email protected] ~]# swapon-s
[Email protected] ~]# blkid/dev/vdc6? #查看设备UUID的信息
[Email protected] ~]# Vim/etc/fstab?
Uuid= "5bbbb9cf-bb65-4b55-80b0-c54b722c2759" swap swap? Defaults 0 0
[Email protected] ~]# swapon-s
[Email protected] ~]# swapon-a
[Email protected] ~]# swapon-s
? ?
Linux system Administrator Technology (Admin)-------Sixth day