Linux disk management and file system

Introduction
The concept of partition:
partition in essence is a kind of format the hard disk. When we create a partition, it has already set up the physical parameters of the hard disk, specify the hard disk master boot record (ie MasterBootRecord, generally referred to as MBR) and boot record backup storage location. The information for the file system and other operating systems needed to manage disk format is advanced through after that Format command. After the surface, tracks and sectors hard disk partition, will be divided into a surface (Side), track (Track) and sector (Sector). It should be noted that these are virtual concept, not really draw a track on the hard disk
MBR Description:
MBR (Master Boot the Record Main the Boot Record) located throughout the hard disk cylinder 0 track 0 sector 1. However, the master boot sector of 512 bytes in total, of which only takes the MBR 446 bytes, the additional 64 bytes to the DPT (Disk Partition Table partition table), the last two bytes " 55, AA "mark the end of the partition. The overall configuration of the main hard disk boot sector.
Partition principle:
The master boot record consists of three parts: part 446byte operating system boot code (MBR), and is part of 64byte primary partition table (DPT).
Master partition table recording partition information up to four primary partitions each partition takes 16byte. Partition is to modify the partition table, it does not affect stored on the hard disk
data in the storage. The last 2 bytes is the end of the flag.
Expansion techniques: a hard disk needs to be divided into more partitions, over five or more partitions, a partition may be up to four primary partitions
region type to extended partition, and then in the extended partition to build a logical partition. Partition logical drive information stored in the extended partition, called the expansion
show the partition table. Theoretically there is no limit number of logical partitions. Extended partition can not be directly used, it must be divided into several logical partitions.
Starting position information are written in a logical partition inside the extended partition table. Division No. 5 starts from the logical partitions, such as: / dev / hda5 first
the first logical partition of the hard disk.
Formatting principles:

分好区的硬盘分区上面什么数据也没有,操作系统也不能读写,为了让操作系统能够识别必须向分区中预写入一定格式的数据。这个过程就称之为格式化。在 Linux 中称为创建文件系统。没有分区的硬盘是不能格式化的,没有格式化的分区是不能直接被使用的。所以分区和格式化往往都是同时进行的。

This chapter structure

  • Disk basis
  • Detect and confirm the new hard drive
  • Planning hard disk partition
  • Create a file system
  • Mounting and unmounting file systems
    a disk structure of
    Linux disk management and file system
    the physical structure of the hard disk
  • Disk: the hard disk has multiple disks, not both sides of the disc
  • Head: a magnetic head for each surface of
    disk data structures
  • Sector: the disk is divided into a plurality of segment areas, to store data of 512 bytes per sector
  • Track: the same concentric circles of different radii of the disk
  • Cylindrical: cylindrical surface of different radius of the disk made of the same
    hard disk storage capacity of the track number x = number of heads x sectors per track bytes per sector x
    may be cylinder / head / sector to uniquely positioned on each disk regional
    disk interface type
  • IDE (Parallel)
  • SATA (serial)
  • SCSI
    two, MBR partition indicates the
    master boot record (MBR: Master Boot Record)
  • MBR located on the hard first physical sector
  • The master boot program and a hard disk contained in the MBR partition table
  • Partition table recording area of four partitions, each partition representing record 16 bytes
    in the Linux hard disk, partitions and other equipment are expressed as document
    Linux disk management and file system

MBR up to four partitions (physical sectors)
the GPT partition 128 may
hd represents IDE device
sd SCSI device showing
three types of file system
XFS file system

  • Store file and directory data partition
  • High-performance journaling file system
  • Use CentOS 7 system default file system
    SWAP, swap file system
  • The establishment of swap partition for Linux systems
    other file system types supported by Linux
  • FAT16,FAT32,NTFS
  • EXT4,JFS......
    四、检查并确认新硬盘
    fdisk命令:查看或管理磁盘分区
    fdisk -l 查看硬盘信息
    Linux disk management and file system
    fdisk -m 查看帮助信息
    Linux disk management and file system
    -n 创建一个新的分区
    Linux disk management and file system
    -d 删除
    Linux disk management and file system
    -t 转换格式
    Linux disk management and file system
    Linux disk management and file system
    -w 保存
    Linux disk management and file system
    -q 退出

mkfs 命令:创建文件系统,格式化
Linux disk management and file system
Linux disk management and file system
mount 挂载命令![]https://s1.51cto.com/images/blog/201911/02/d4cef7716f93e7e235856afef665e864.jpg?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
umount 卸载已经挂载的文件
/etc/fstab 配置文件,包含需要开机后自动挂载的文件系统记录
Linux disk management and file system
Linux disk management and file system

/dev/sdb1 /mailbox xfs defaults 0 0
分区 挂载点 文件系统类型 权限功能 容灾 序列

LVM逻辑卷概述
LVM逻辑卷管理

  • 动态调整磁盘容量,从而提高磁盘管理的灵活性
  • /boot分区用于存放引导文件,不能基于LVM创建
  • GUI management tool system-config-lvm
    Linux disk management and file system
    main command
    pvcreate device name a device name [2] ......
    vgcreate physical volume name of the volume group name of a physical volume 2
    the lvcreate -L capacity size -n logical volume group name name
    lvextend -L + size / dev / vgname / logical volume name

Summarizes the
Linux disk and file management system that allows us a better understanding of the knowledge about Linux. Not too much content, it is not hard to understand, there are new commands we need to remember, remember the basic commands and syntax on it.
Ah establish LVM logical volumes command to find a few rules you can easily remember. Command, the syntax is very important and fundamental part, we have to knock more practice to consolidate!

Guess you like

Origin blog.51cto.com/14557905/2447301