admin1.5
Zoning Planning and use:
Hard disk partition management:
Use the Fdisk partitioning tool:
View a list of partitions:--fdisk-l/DEV/SDA
To modify a partition table for a hard disk:--fdisk/dev/vdb
Common Interactive Commands:
-M: list instruction help;
-P: View existing partition table;
-N: New partition;
-D: Delete partition;
-Q: Discard changes and exit;
-W: Save changes and exit;
identify the new partition table : Use the Partprobe command;
----When the partition table of the hard disk is changed, it is necessary to notify the Linux kernel of the change of partition table, preferably reboot once;
----may not be able to find an accurate device when accessing the partition;
#partprobe/dev/vdb or #reboot
To format a partition:
Common formatting tools:
MKFS Tool Set:
----MKFS.ETC3 Partition device path
----MKFS.ETC4 Partition device path
----MKFS.XFS Partition device path
Create file System: Format partitions according to different types
#mkfs. ext4/dev/vdb2
#mkfs. xfs/dev/vdb3
--------------------------------------------------------------------------------------------------------------- -----------------------------
Accessing the file system
To access a formatted partition:
Mount using the Mount command and access the test:
#mount/mnt/part2
#mount/dev/vdb2/mnt/part2
#cp/etc/fstab/mnt/part2/fstab.txt
#ls/mnt/part2
To automatically mount the boot:
Record format for configuration file/etc/fstab
---device path----mount point----Type-----Parameters-----Backup tag-------detection sequence
#mkdir/MNT/PART3//Create mount point
#vim/etc/fstab
#mount-A//detection configuration
--------------------------------------------------------------------------------------------------------------- -----------------------------
LVM logical Volumes
To create a new logical Volume:
How LVM works:
A logical layer added in the middle of "Partition"-------"Formatting"
--------physical volumes stored----scattered space
----Consolidated Virtual Disk-----Volume Group
----a virtual partition------------logical Volume
LVM Management toolset:
Functional------------------------Physical Volume management---------------Volume Group Management-----------------Logical Volume management
Scan Scan-----------------pvscan-----------------------vgscan---------------------Lvscan
Create--------------pvcreate-------------------vgcreate-------------------lvcreate
Display displays-------------pvdisplay------------------vgdisplay-----------------lvdisplay
Remove delete-------------pvremove------------------vgremove----------------lvremove
Extend extension---------------------------------------------vgextend-----------------lvtend
LVM rapid Deployment and use:
Basic ideas:
Prepare at least one free partition (DEV/VDB1)
Create Volume Group: vgcreate Volume Group name Idle partition
Create Logical Volume: Lvcreate-l size-N name Volume group name
Integrated zoning Planning
PE size for LVM volume group
To set the PE size when creating a volume group---
--#vgcreate-S PE size volume group name free partition ....
Specify the number of PE---when creating a logical volume
--#lvcreate-L PE number-n Logical name Volume group name
To extend the logical volume size:
Check the existing logical volume size:
Using the Lvscan command, find the logical volume size, Volume group name:
Check the remaining space of the volume group to see if the name meets the expansion requirements;
To extend a volume group:
When the volume group has insufficient remaining space, the volume group needs to be expanded first:
Extended Volume Group: vgextend Volume Group name Idle partition
To extend a logical volume:
The logical volume can be expanded directly when the volume group has sufficient remaining space
Extended Logical Volume: lvextend-l New size/dev/Volume group name/Logical volume name
Update file system size
--For a formatted logical volume, the Linux kernel should be notified after the extension
To refresh file system capacity:
RESIZE2FS EXT3/4 device Xfs-growfs XFS device
--------------------------------------------------------------------------------------------------------------- -------------------------
Managing Swap Space
Preparing swap partitions
What is swap space : equivalent to Virtual memory
---Use disk space to simulate memory when physical memory is insufficient;
---to some extent, alleviate the memory shortage problem;
---swap partition: Serves as the swap space with an idle partition;
---swap file: The swap space that the device that the file simulates is acting as;
How to create a swap partition:
---will provide the device with the swap command to format-----MKSWAP free partition or device file
#blkid/DEV/VDB6//view device block ID
Use swap partition:
Enable control for swap space:
To manually manage your device:
--#swapon/DEV/VDB7//Enable
--#swap-S//view
--#swapoff/dev/vdb7//Deactivate
Power-on Mount configuration for switching devices:
Modifying the/etc/fstab configuration file
Format: Swap device swap swap defaults 0 0
#vim/etc/fstab
#swapon-A//start fstab available switching device;
#swapon-S//view
This article is from the Linux OPS blog, so be sure to keep this source http://13401400.blog.51cto.com/13391400/1977887
Linux admin1.5 (zoning planning and use, LVM logical volume, swap space)