11, Linux disk management

1, linux current system supports two dynamically expanding disk management : .
1, RAID Management: This is for initializing a hard disk management system before installation, the widespread use raid0, raid1, raid5, raid10 logical disk arrays and other management.

raid0:至少1块盘 读写速度快   无冗余 一块盘损坏数据丢失               
raid1:至少2块盘 读写速度慢   一块读写一块备份    可以损失一块盘             
raid5:至少3块盘 速写速度快   一块校验盘   可以损失一块盘             
raid10:至少4快盘    读写速度快   一半读写一半备份    可以损失一半硬盘                

2, the disk management system is done by installing LVM commands (gradually becomes small)

2, the hard disk classification:
1, hard Classification by structure:
mechanical hard disk (an HDD: slow data storage for large amounts of low cost
solid state drive (SSD) familiar fast SSD (memory) costs are high

2, in accordance with the classification of hard disk interface:
SCSI
SATA
SAS (mainstream)
PCI-E

under / dev is the Linux file system so hardware device
/ dev / sda represents the first hard disk
/ dev / sda1 represents the first hard disk first partition
/ dev / sda2 represent the first hard disk second partition
/ dev / sda3 representation a third partition of the hard disk
/ dev / sda4 represents a fourth partition the hard disk
Note: a hard drive up to four primary partitions. Or three primary partition, the primary partition fourth extended left out to make partition (Extend), starts from the name / dev / sda5
/ dev / SDB indicates a second hard drive
/ dev / sdc a third hard disk
MBR sector: co 512K, the location of the master boot record

fdisk -l to view the current hard disk partition
df -h to view the current partition using the mount case
lsblk displayed in a tree structure partitioning
blkid view the partition uniquely represented UUID
/ etc / fstab file to automatically mount the partition

3, there are two main disk partition command:
fdisk : maximum support no more than 2T partition
parted : support GPT, suitable for large-capacity partition

fidsk partition command
Step a: the fdisk / dev / SDA
P current partition where
n create partitions
primany selected from the primary partition
extended extended partition is selected from
d Delete Partition
w save settings
Step two: the mkfs.xfs / dev / sda1
the performance of ext2
ext3
ext4 series with Linux6 file system format
xfs linux7 series with the file system format
of course: a hard disk can not partitions formatted using it directly, if using monolithic disk speed faster than the partition using
step three: Mount
mount / dev / sda1 / mnt the partition is mounted in the / mnt directory, when you write data in the / mnt directory is to write data to / dev / sda1
umount / dev / sda1
umount / mnt mount uninstall
step four: implement boot automatically mount the partition
1 , echo 'Mount / dev / sda1 /mnt'>>/etc/rc.local
2, written in / etc / fstab
11, Linux disk management
parted: command partition
parted -l to view the current regional situation
step one: parted / dev / sda partition
mktable create a disk label GPT, fdiskz support is the MBR
gpt handwriting gpt
the p-check the partitions
mkpart start partition
11, Linux disk management
can always go on a partition ... parted partitioning support 128 primary partitions
Step two: mkfs.xfs / dev / sdb1
Step three: Mounting
Step four: to achieve power automatically mount

4, the business case:
the Java environment is not enough memory, swap area occupied
free -h to view the current mem and swap details
dd if = / dev / zero of dd essence = / tmp / 200m bs = 1M count = 200 is to create a file, copy the file command Function

/ dev / zero white hole continuously output the contents of
/ dev / null black hole constant content intake

mkswap / tmp / 200 format the partition
swapon / tmp / 200 activating swap partition

5, the system find large files
. 1, Find / 2G + -type -szie F | xargs LS -LH
11, Linux disk management
2, Find / 2G + -type -size F {} -LH -exec LS \;
11, Linux disk management
. 3, du
11, Linux disk management
. 6, add The default gateway
route the Add default gw xxxx
route del defalut gw xxxx

Add routing entries
ip route add 0/0 via gateway
ip route del 0/0 via gateways

NIC add ip
ip address the Add xxxx / 24-dev eth0
ip address the Add xxxx / 24-dev eth1

Guess you like

Origin blog.51cto.com/13858002/2433203