In the enterprise management of the Linux server, you have to face a problem that is the partition, next to share with you how to properly manage the disk.
Partition Table Type
MBR 4 Primary partitions
GPT supports 128 primary partitions
Based on MBR partition table
C DOS Compatibility mode
U mode
Fdisk-cu/dev/sda
Fdisk/dev/sda
M for help---> View assistance
D Delete Partition
L list the types of known partitions
N New Partition
P View Partition Table
Q Exit does not save
T change the system ID of the partition (L)
W Save and exit
Partition
Fdisk/dev/sda
P View
N New
E (Extended)/P (primary partition)
First Cylinder start cylinder (default)
Last cylinder +26--"200M End Cylinder
+200m-->200m K, M, G
W Save exit
PARTX-A/DEV/SDA Update partition table
Mkfs.ext4/dev/sda5 formatting
Mkfs-t Ext4/dev/sda6 Formatting
Mkdir/sda5 Creating mount Points
mount/dev/sda5/sda5/Mount
Mount
mount/dev/sda5/sda5/
Mount-t ext4/dev/sda5/sda5/
Unloading
Umount/dev/sda5
umount/sda5/
How to mount the boot:
1.vim/etc/rc.local
mount/dev/sda5/sda5/
2.vim/etc/fstab (Mount-a can make the second table restart immediately)
UUID=D230979F-A6D8-4C87-AD9C-3C03F54F8521/EXT4 Defaults 1 1
1. Partitioning equipment
2. Mount point
3. File system type
4. Default properties for Mounts
Defaults contains: RW, suid, dev, exec, auto,nouser, async, and Relatime
5. Whether to enable tape drive backup 0 1
6. Check File system 1 (root partition) 2 before mounting
Partition device
1.uuid Blkid View uuid for all partitions
2./dev/sda2
3.lable=it Settings tab E2LABEL/DEV/SDA5 IT
View Label E2label/dev/sda5
Uuid=c3e333ad-3d56-4796-a6b1-a0959e68e708/sda6 EXT4 Defaults 1 2
/dev/sda6/sda6 EXT4 Defaults 1 2
Label=it/sda5 EXT4 Defaults 1 2
3.autofs (auto Mount)
Autofs-5.0.5-73.el6.x86_64
Demand:
/dev/sda6---"/test/sda6
Mkdir/test
1. Configure the master configuration file
Vim/etc/auto.master
/test/etc/auto.sda6
First section mount point defines the file name and absolute path of the secondary profile
2. Configure the secondary configuration file
Vim/etc/auto.sda6
Sda6-fstype=ext4,defaults:/dev/sda6
2nd section mount point without having to create the-fstype definition file system type and the partition to mount the property in advance
3./etc/init.d/autofs Restart Restart Service
4.cd/test
CD Sda6
Df-h
View partition information for a hard disk
1.FDSIK/DEV/SDA---"p
2.fdisk-l/DEV/SDA
Mans Mount
Mount-a--->/etc/fstab reload
-T Ext4
-O Rw,ro,remount,username,password,async
-l-t EXT4 lists only the file system type of the system Mount Ext4
-R Read-only
-W Read-write
-L IT mounts based on tags
-U UUID
Property
Async Atime Auto Defaults () dev exec relatime suid remount ro rw Sync user users
Mount-o REMOUNT,RW/SDA6----> re-mount/DEV/SDA6 partition Properties RW
Remount can re-mount new properties without unloading mount points
fdisk-l [/DEV/SDB] viewing disk information
------------------------------------------------------
GPT partition table
Parted/dev/sdb
H
Check 8 (number) checks the 8th partition
mklabel,mktable label-type Conversion Partition Table type (MBR GPT)
MKFS number Fs-type to format a partition as the specified file system type
Mkpart part-type (main extension logic---description information) [Fs-type] START END create partition
Name Number name modifies the description of the partition
Print [devices|free|list,all| Number] View partition information
Quit quitting
Rescue START END to retrieve the lost partition
Resize number START END dynamic Sizing
RM Number Delete Partition
Select DEVICE Edit Partition
New Partition
Parted/dev/sdb
Mklabel (GPT) conversion partition table type
Mkpart
IT1 Partition Name
Space File System type
Starting point 0
End Point 200M
i/i Ignore
Q exit
PARTX-A/DEV/SDB Update partition table
MKFS.EXT4/DEV/SDB1 formatting
Mkdir/sdb1
Mount/dev/sdb1/sdb1
/etc/rc.local
/etc
/fstab
AutoFS
echo "MOUNT/DEV/SDB1/SDB1" >>/etc/rc.local
Df-h
Rescue
Umount/sdb1
Parted/dev/sdb
Rm
1
Q
Partx-a/dev/sdb
Reboot
Parted/dev/sdb
P
Rescue 0 200M
P
Partx-a/dev/sdb
Mount/dev/sdb1/sdb1
H Mklabel Mkpart Rescue RM Q
Parted-l Viewing partition information
Parted-s/dev/sdb Mkpart it3 500M 700M via script partitioning
Homework:
1. Script Partitioning
2. Mount swap partitions in multiple ways
3.rhel-server-6.4-x86_64-dvd.iso mount to/etc/fstab--->iso9660
/home/rhelxxx.iso/mnt ios9660 Defaults 0 0
Mount-o loop/home/rhelxx.ios/mnt Mount-o loop only for mirroring
----------------------------Swap partition-------------------------------
How do I view swap partitions?
Free
Swapon-s
1. General mode
Fdisk/dev/sda
N
+200m
W
Partx-a/DEV/SDA
MKSWAP/SDA9 formatting
SWAPON/DEV/SDA9 activation
Swapon-s
2. Using an existing partition to simulate swap partitions
DD If=/dev/zero OF=SWAP1 bs=100m count=1
If from where to get resource of output to what location BS unit block size count quantity
20M---"bs=10m count=2
bs=20m count=1
Mkswap/sdb1/swap1 formatting
SWAPON/SDB1/SWAP1---> File
Linux Disk Management