The fourth week of knowledge sharing small

The fourth week little knowledge summary


时间过得飞快,转眼间就到第四周了,我们又学了哪些新知识呢,下面让我们一起来看下。  

A source compiler installation

1 package compiled

Compile and install the package:

Application-VERSION-release.src.rpm -> after installation, use rpmbuild command rpm package made into binary format, and then install the
source code -> Pretreatment -> Compiler -> Assembler -> Links - > execute
source code organization format:
multi-file: file between code is likely to exist across file dependencies
C, C ++: make project Manager
configure script -> Makefile.in -> Makefile
the Java: Maven
compile and install
C language source code compiler installation step three:
. 1, / Configure.
(. 1) passing through the option parameter, specific characteristics, and the like to enable the installation path; will refer to the user when performing
the specified file and generating Makefile.in the Makefile
(2) to check dependencies the external environment, such as the dependence of the package
2, make according to the Makefile to build applications
3, make install copy the file to the appropriate path
of development tools:
autoconf: generate the configure script
automake: generating Makefile.in
Note: before installing the README, iNSTALL
compilation installation
compile the C source code:
preparation: to provide development tools and development environment
tools: make, gcc and other
development environments: development libraries, header files,
glibc: standard
Implementation: providing development components the "packet group"
Tools Development
Server Platform Development
Practice :( system minimization based installation)
yum the install GCC GCC-C ++ the glibc the glibc-devel
PCRE PCRE-devel
OpenSSL OpenSSL-devel systemd-devel
zlib-devel lrzsz Tree Screen lsof vim
tcpdump wget ntpdate NET-Tools iotop bc the unzip ZIP nfs-utils
first step: configure script
options: specify the installation location, specify enabled features
--help: obtain their support for the use of options
options Category:
installation path set set:
--prefix = / the PATH: Specifies default installation location, default usr / local /
--sysconfdir = / the PATH: installation location profile
System types: cross-compilation to
optional Features: optional feature
--disable the FEATURE-
- the FEATURE-enable [= ARG]
optional The the packages: optional package
--with-pACKAGE [= ARG] dependencies
--without-PACKAGE dependencies disabled
Note: The operation is generally dependent package compiled program, the need to install this package "development" component,
which is generally similar to the package name name-devel-VERSION
Step: make
Third Step: make install
post-installation configuration:
(1) import binary program directory to the PATH environment variable
to edit files /etc/profile.d/NAME.sh
Export PATH = / PATH / the tO / BIN: $ PATH
(2) import help manual
editing /etc/man.config|man_db.conf file
to add a MANPATH

Two disk partitions

CHS and LBA

CHS
uses 24bit addressing bits
wherein 10 represents the front cylinder, intermediate 8 represents a head, behind the six sector represents
the maximum addressable space 8GB
the LBA (Logical Block Addressing)
the LBA is an integer, the disk is completed by addressing the specific format converted CHS
ATA-1 specification defines 28-bit addressing mode, calculated per group of sectors 512, ATA-1 predetermined
defined LBA 28 reaches the upper limit 128 GiB. In 2002 ATA-6 specification uses the LBA 48, likewise
size limit calculated for each group of sectors 512 up to 128 Petabytes
Since CHS addressing mode address space of less than about 8GB, disk capacity is less than about 8GB
, it is possible to use CHS LBA addressing mode or addressing mode; when the disk capacity is greater than about 8GB, you
can only use the LBA addressing mode
using a step partition space
equipment identification
device partition
to create a file system
tag file system
creates an entry in the / etc / fstab file
mount the new file system
disk partition
significance partition:
optimize I / O performance
for disk space quotas
to improve the rate of repair
isolation systems and procedures
to install multiple OS
uses a different file system
partition

Two kinds of partitioning: MBR, GPT

MBR: Master Boot Record, 1982 years, the 32-bit number of sectors, said partition does not exceed the 2T
how partitions: press cylinder
0 track 0 sector: 512bytes
446bytes: Boot Loader
64bytes: partition table, a partition identifies each 16bytes
2bytes : 55AA
the MBR partition a hard drive up to four primary partitions, a main partition 3 may be extended + 1 (N logical partitions)
the GPT partition
GPT: GUID (Globals Unique Identifiers) partition table partition 128,
64-bit, support 8Z (512Byte / block) 64Z ( 4096Byte / block)
using 128 UUID (Universally Unique Identifier) represents a disk partition and automatic backup GPT partition table in two head and tail, and the CRC check bits
UEFI (unified Extensible Firmware Interface unified extensible firmware Interface) hardware support GPT, the operating system starts

Managing Partitions

Listed block device
• lsblk
create a partition use:
• Creating fdisk MBR partition
• gdisk create GPT partitions
• parted advanced partition operations
to reset the partition table in memory kernel version
• partprobe
parted command
operations are parted with immediate effect, be careful with
the use of : parted [option] ... [equipment [command [argument] ...] ...]
parted / dev / sdb mklabel gpt | msdos (mklabel: tag, type) (gpt and msdos two types)
parted / dev / sdb print (displays the current hard disk partition
parted / dev / sdb mkpart primary 1 200 ( default M) (represented large partition to separate the 199M)
parted / dev / sdb RM 1 (represented delete points out sdb1 partition)
parted - l list partition information
partitioning tools fdisk and GDisk
GDisk / dev / sdb class of GPT fdisk partitioning tool
fdisk -l [-u] [device ... ] view the partition
fdisk / dev / sdb partition management
subcommand:
the p-partition list
t change the partition type
n to create a new partition
d delete partition
v verify the partition
u conversion unit
w save and exit
q exit without saving
if not minutes after the show, we need to use the command partprobe new partition, and then you can see.
But this command to do so on centos6,
starting partx -a / dev / sda, then you can see.
(-A: a recognition of the increased partition)
If you delete a partition is to identify: starting a partx -d --nr 5-7 / dev / sda ( assuming that deleted partition 5-7) to identify
Note: Do not pay more digital partition ,invalid

Three file system management

1 File System

OS file system is used in the process and data structures of the file on the storage device or partition clear; method, i.e. the file on the storage device in tissue. Software architecture operating system responsible for managing and storing file information called a file management system, referred to as the file system
files from the system point of view, the file system is space for file storage and distribution equipment are organized, responsible for file storage and deposit protection and retrieval systems. Specifically, it is responsible for setting up files for the user, stored, read, modify access, dump files, control files, security control, logging, compression, encryption and other
supported file systems: / lib / modules / uname –r/ Kernel / fs (supported file system view system)
various file systems:
https://en.wikipedia.org/wiki/Comparison_of_file_systems can browse this site at

2 file system type

Linux file systems:
ext2 (Extended File System): applies to those partition size is not too large, not frequently updated situation,
such as the / boot partition
ext3: ext2 is an improved version of its journaling, which can help the system from abnormal caused by abnormal shutdown recover. It is commonly used as a general-purpose file system
ext4: ext is the latest version of the file system. Offers many new features, including a nanosecond timestamp, create and use a giant file (16TB), the largest 1EB file system, as well as to enhance the speed of
xfs: SGI, support up to 8EB file system
btrfs (Oracle), reiserfs, jfs (AIX), swap (virtual partitions)
CD: iso9660
Windows: FAT32, NTFS, exFAT
Unix: FFS (the FAST), UFS (UNIX), JFS2
network file system: NFS, CIFS
cluster file systems: GFS2, OCFS2 (oracle)
distributed file system: FastDFS, Ceph, MooseFS, MogileFS, GlusterFS, Luster
the RAW: untreated or unformatted generated file system (bare disc
lsmod: system modules currently loaded in the file system,
users access the hard disk file vfs system (virutal file system: file virtual file system, a unified standard, so a command to access different file systems, and the effect of non-discriminatory)
/ proc / fliesystem: systems support file system types
Journaled file systems: ext3, (ext4, xfs: does not support shared

3 Create a file system

mkfs command:
(. 1) mkfs.FS_TYPE / dev / the DEVICE
ext4 XFS Btrfs vfat
columns such as: mkfs.ext4 / dev / sda6 (sda6 is to create a file system and partition ext4)
or: mkfs -t ext4 / dev / sda6 ( after you have created will be assigned a unique UUID number)
blkid: View a list of file systems and uuid
(2) fs_type mkfs -t / dev / the DEVICE
-L: 'lABEL' set volume label: label (e2label -l: Look at the label , may also be modified, only ext series)
-b: block size (mkfs.ext4 / dev / sda6 -b 1024 , represents the creation of a large file system 1k)
default 4096 = 4k, can also be specified. tune2fs -l / dev / sda6: See block size
columns such as: mkfs -t ext4 -L / date / mysql / dev / sda6 ( tags is / DATE / MySQL)
(. 1) Create ext file system
(file system can only create ext
mke2fs: ext series dedicated file system management tool
-t {ext2 | ext3 | ext4} specifies the file system type
-b {1024 | 2048 | 4096} specify the block size
-L 'lABEL' set volume label
-j corresponds ext3 -t
the mkfs .ext3 = mkfs -t ext3 = mke2fs -j = mke2fs -t ext3
-i # data space to create a number of bytes per inode is; it should not be less than block size (> = 4096)
the number of inode creation -N # specified partition
-I inode a record amount of disk space, 128-- -4096
-m # default 5%, the percentage of total space reserved for root can be changed: (mkfs.ext4 -m 1 / dev / sda6, expressed reservation% 1
-O FEATURE [, ...] enabled specific characteristics
-O ^ FEATURE off characteristics specified
dd if = / dev / zero of = / dev / sdb1 bs = 1M: destruction partition
(2) file system label
pointing device another method
and apparatus independent
blkid: attribute block device View
blkid [OPTION] ... [the dEVICE]
-U UUID to find the corresponding devices in accordance with the specified UUID
-L LABEL to find the corresponding set according to the specified LABEL
e2label: management ext family filesystem LABEL
e2label the dEVICE [LABEL]
findfs: find the partition
findfs [Options] the lABEL = <label>
findfs [Options] the UUID = <UUID>
the tune2fs
the tune2fs: reset value ext series of adjustable parameters file system
-l See specified file system superblock information; super block
-L 'LABEL' to modify the label
-m # repair space reserved for the administrator's percentage
-j will upgrade ext2 to ext3
-O file system attributes to enable or disable, -O ^ has_journal
default file system mount -o adjustment options , ^ -o acl
(partition file system created on centos default ACL without permission, if necessary, add their own)
-U UUID modify UUID number
dumpe2fs: ext file system information display, disk blocks will be grouped tube
-h: View super block information, grouping information is not displayed
xfs_info: Shows information about the mounted file system xfs
xfs_info the mountpoint
(. 3) detect and repair the system files
after the file folder system crash or a failure often occurs in the non-normal shutdown, the file system is mounted as marked "no clean"
Note: be sure not to execute the following command in the mounted state of repair
fsck: file system Check (just repair the file system, data is not guaranteed)
fsck.FS_TYPE
fsck -t fs_type
Note: fS_TYPE must be the same as the partition file types
-a auto repair
-r interactive fix the error
e2fsck: ext series of documents dedicated check and repair tool
-y automatically answer is yes
-f Force fixing
-p Automatically fix file system security issue
xfs_repair: xfs file system repair tool specific detection
-f file repair, and the device
-n checks only
used when repairing -d allows read-only mount equipment, single-user repair /, then immediately reboot

4 Mount mount

lsof / dev / mysql: View user is accessing the directory
fusr -v / date / mysql: users are using this directory
fusr -km / date / mysql: Excluding users
to mount: the file system with certain additional existing root file system directory established relationship, thus making this directory as the file access behavior of other entry
unloading: to clear this association process relationships
to associate the device mount point: Mount point
Mount
unloading: You can use the device can also be used to mount point
umount the device name | mount point
mount point under the original file after the mount is completed will be temporarily hidden
mount point directory is usually empty
one device can be mounted to more than one folder in
a folder can only mount a equipment mounted equipment will be squeezed out after the first mount device.
1, the device is generally forgotten folder mount
2, you can also mount the file to a folder after (the creation of the file system can be mounted on the file to the directory, after the establishment of the folder is mounted, there will be loop0, automatically mounted on loop0, will be automatically mounted on centos7, does not limit .losetup can see the default command only eight on .centos6, does not automatically mount on loop0, have to add -o ioop options available in / root / grub / grub.conf in max + plus digital and then restart to take effect.
3, can also mount the directory to the directory appears not to mount, and needs -B option (-n represents hidden mounted in Canada, Not valid on 7)
Mount options for common commands
the file system type specified on the -t vsftype device to be mounted
-r readonly, read-only mount
-w read and write, read mount
-n Do not update / etc / mtab, mount invisible (not valid on 7)
-a automatically mount all supported automatically mount devices (defined in the / etc / fstab file and mount options have auto function)
-L 'LABEL' to specify the label mount device
-U 'UUID' UUID to specify the device to be mounted
-B, --bind binding directory to another directory
View kernel to track all of the mounted equipment
CAT / proc / mounts
-o options :( option to mount the file system), multiple options separated by commas
async asynchronous mode sync sync mode, memory changes, while writing to disk
atime / noatime contains directories and files
diratime / nodiratime directory access timestamp
auto / noauto support auto-mount, whether to support the -a option
exec / noexec on whether to support the operation of the file system application
dev / nodev supports the use on this file system device file
suid / nosuid support suid and sgid permissions
remount remount
ro read only rw read and write
user / nouser whether to allow ordinary users to mount this device, / etcfstab use
acl acl-enabled features on this file system
loop using loop Preparation
_netdev When the network is available to mount if network resources, such as: NFS filesystem
defaults equivalent rw, suid, dev, exec, auto, nouser, async

RAID

IO capabilities improve
disk read and write in parallel
to improve the durability of the
disk redundancy to achieve
Level: multiple disks grouped together work differently
ways to achieve RAID
external disk array: adaptation capabilities provided by expansion cards
fit within the RAID: onboard RAID controller, prior to installation in the BIOS, OS configuration
software RAID: OS implemented by
RAID level
RAID-0: striped volume, strip
RAID. 1-: mirrored volumes, mirror
RAID-2
..
RAID. 5-
RAID. 6-
RAID -10
RAID-01

RAID-0:

(If three hard disks, a uniform store data for each 1/3 hard, but a bad, can not be used)
reading and writing performance
of free space: N; utilization: 100%
No fault tolerance
minimum number of disks: 2, 2+ (if different space, can only use the partition space of the same size)

RAID-1:

(Addition of two hard disks, two data, the similar image, a pharmaceutically hard disk is damaged, if the data deleted human, can not be retrieved)
read performance, write performance slightly decreased
the space available: n / 2; utilization: 50 %
redundant capability
minimum number of disks: 2, 2N

RAID-4:

At least three disks; usage: n-1 / n
pieces of data an exclusive OR operation value of the disk is stored in a dedicated parity disk

RAID-5:

Reading and writing performance
utilization: n-1 / n
fault tolerance: a disk damage Maximum
Minimum number of disks: 3, 3+

RAID-6:

Reading and writing performance
of free space: n-2 / n
fault tolerance: Maximum two disk damage
minimum number of disks: 4, 4+

AID-10 :( most used in the production)

Reading and writing performance
of free space: 50%
fault tolerance: each image a maximum of bad (bad two allowable
minimum number of disks: 4, 4+

RAID-01:

(Utilization 50%, n-2 / n ,)
happened Sikuai
multiple disks to achieve RAID0, and then combined into RAID1
JBOD disk :( accumulated simply extended memory)
Function: a plurality of disk space a large continuous combined use space
available space: sum (S1, S2, ... )

Guess you like

Origin blog.51cto.com/14453539/2430479