The performance of hardware devices in Linux systems
Device files
I/O ports:i/o device Address
All documents:
Open (), read (), write (), close ()
Device Type:
Block devices: block, Access unit "blocks", disk
Character device: Char, Access unit "character", keyboard
Device files: Linked to a device driver to communicate with the corresponding hardware device
Device number:
Main device number: Major numbers, identifying device types
Second device number: Minor numbers, identifying different devices under the same type
Hard Disk interface type
Parallel:
ide:133mb/s
scsi:640mb/s
Serial:
sata:6gbps
sas:6gbps
usb:480mb/s
Rpm:rotations per minute (RPM)
Device files
Device file name for disk device:/dev/dev_file
IDE:/DEV/HD
SCSI, SATA, SAS, USB:/DEV/SD
Different devices: A-Z
/DEV/SDA,/dev/sdb, ...
Different partitions on the same device: 1, 2, ...
/DEV/SDA1,/dev/sda5
Physical structure of hard disk
Hard disk storage Terminology
Head: Head
Track: Tracks
Cylinder: Cylinder surface
SECOTR: Fan area, 512bytes
Using partitioned space
Device identification
Device Partitioning
Creating a file system
Tag File system
Create an entry in the/etc/fstab file
Mount a new file system
Disk partitioning
Why a partition?
Optimizing I/O performance
Implementing disk space Quota limits
Improved repair speed
Isolating systems and programs
Install multiple OS
Hard disk Partitioning
Why a partition?
Optimizing I/O performance
Implementing disk space Quota limits
Improved repair speed
Isolating systems and programs
Install multiple OS
Partition
Two ways to partition: MBR, GPT
Mbr:master boot Record, 1982, using 32-bit representation of sector number, partitions not exceeding 2T
How to partition: Press Cylinder
0 Track 0 Sector: 512bytes
446bytes:boot Loader
64bytes: Partition Table
16bytes: Identify a partition
2bytes:55aa
4 primary partition, 3 primary partition +1 extension (n logical partition)
MBR partition structure
GPT Partition
Gpt:guid patition Table supports 128 partitions, using 64-bit, supported
Holding 8Z (512byte/block) 64Z (4096byte/block)
Using a 128-bit UUID indicates that the disk and partition GPT partition tables are automatically backed up in the header
and two parts of the tail, and a CRC check bit
UEFI (Unified extension Firmware interface) hardware support GPT
GPT partition structure
The EFI section can also be divided into 4 areas: EFI Information area (GPT header), partition table, GPT partition, backup area
Managing partitions
List block devices
Blkid
To create a partition using:
FDISK creates an MBR partition, also supports GPT, and can manage up to 15 partitions for a hard disk
Gdisk creating a GPT partition
GNU parted advanced partitioning operations (create, copy, resize, etc.)
partprobe-re-setting the kernel partition table version in memory
Fdisk/dev/sdb
Gfisk/dev/sdb
# fdisk-l [-u] [device ...]
Sub-command:
P Partition List
t change the partition type
n Create a new partition
D Delete Partition
W Save and exit
Q Do not save and exit
Partitioning tools Fdisk and Gdisk
Synchronizing partitioned Tables
To see if the kernel has identified a new partition:
# cat/proc/partations
Notifies the kernel to re-read the hard disk partition table
New Partition with
Partx-a-N m:n/dev/device
Kpartx-a/dev/device-f: Force
Delete partition with
Partx-d-N m:n/dev/device
Centos6:–nr n-m
CentOS 5, 7: Using Partprobe
Partprobe [/dev/device]
parted command
Parted operations are in real time, use caution
Usage: parted [options] ... [Device [command [parameters] ...] ...]
Parted/dev/sdb Mklabel Gpt|msdos
PARTED/DEV/SDB Print
Parted/dev/sdb Mkpart Primary 1 200 (default m)
PARTED/DEV/SDB RM 1
Parted-l
File system
A file system is a party that the operating system uses to explicitly store files on a device or partition
The method of organizing files on the storage device. Operating system
The software structure for managing and storing file information is called a file management system,
Abbreviation file system.
From a system point of view, a file system is a group of space for a file storage device
and distribution, responsible for file storage and protection and retrieval of documents deposited
System. Specifically, it is responsible for creating files for users, depositing, reading, repairing
Change, dump files, control file access, security control, logs, compression,
Encryption, and so on.
File system type
Linux file systems: ext2, Ext3, Ext4, XFS (SGI), Btrfs (
Oracle), ReiserFS, JFS (AIX), swap
Swap: Swap partition
Disc: iso9660
Windows:fat32, NTFS
Unix:ffs (FAST), UFS (Unix), JFS2
Network File system: NFS, CIFS
Clustered file system: GFS2, OCFS2 (Oracle)
Distributed File systems: Ceph, Moosefs, MogileFS, Glusterfs,lustre
RAW: Unprocessed or unformatted file system
File System classification
Depending on whether it supports the "journal" feature:
journaled file system: ext3, Ext4, XFS, ...
Non-journaled file system: ext2, VFAT
Part of the file system:
Modules in the kernel: Ext4, XFS, VFAT
User space management tools: MKFS.EXT4, Mkfs.xfs,mkfs.vfat
Virtual file system for Linux: VFS
Pre-check supported file systems: Cat/proc/filesystems
Creating a file system
MKFS command:
(1) # MKFS. Fs_type/dev/device
Ext4
Xfs
Btrfs
Vfat
(2) # mkfs-t Fs_type/dev/device
-L ' LABEL ': Set volume label
Create ext File System
Mke2fs:ext Series file system dedicated management tools
-T {EXT2|EXT3|EXT4}
-B {1024|2048|4096}
&nbs
Linux disk knowledge, partitioning and file system