File system:
How the operating system recognizes disks and partitions:
Mbr:master boot record, master boot recording, storage disk information, including partition information, operating system boot program, glyph. A sector size
The MBR is 512 bytes in total, and the following are the allocations for these bytes:
512bytes:
Bootloader:446bytes:
The bootloader program, the program that loads the operating system, is used to start the operating system, for example, which operating system can be started at boot, which is the information
Fat: (disk partition) file system Allocation table, 64bytes, 16bytes boot a partition, so only four primary partitions, the boot function, that is, in order to find, not the specified size
MBR validity tag: 5A, remaining two bytes
MBR is not part of any partition, the first thing the machine starts is this
4: Primary partition, extensible
3 primary, 1 Extended partition: Referencing additional partition tables:
Each primary partition is an allocation table that points to information such as where the partition belongs
The primary partition is the allocation table for each zone, because the disk is getting larger, so the 16-byte allocation table is not enough, so the extended partition needs to be raised, and the extended partition is used to refer to the additional partition table, which means that the extended partition points to a larger allocation table, which points to its defined partition, which is the logical partition.
Logical Partitioning
Primary partitions are limited in partitioning tables because the boot partition is too small
The hard disk devices are present in this directory:/dev/
HDD Interface:
IDE (ATA) controller: The same port, each controller can connect two hard drives, master/slave a master one from, 133mb/s
/dev/hd[a-z] in CENTOS6, HD is the SD, HDA represents the first hard drive (main disk), HDB represents the second hard drive (slave disk)
Each disk has a large number of partitions, each of which appears to be a standalone device, which is independently set to access the
/dev/hda
/dev/hda[1-4] represents the primary partition of the HDA hard Drive, 1-4 represents the area
/dev/hda[5+] 5 represents logical partition after
SCSI device: Small computer System Interface very, very fast.
320mb/s
SATA (Serial): 300Mbps, 600Mbps, 6Gbps
Sas:6gbps out a lot of interfaces, one hard drive after another
Usb:
/DEV/SD[A-Z] SD is the logo of the system to identify the hard disk interface, CENTOS6 are unified for the SD, can be distinguished, the following letter is to indicate which hard disk
[1-4]
[5+]
The kernel accesses the disk through a device file under/dev
/proc file is the current operating system kernel state data and configuration information,/proc is a pseudo-file system, output by the kernel, user-friendly program to view the current system of how much partition information interface
The contents of the partitions file under proc are the hard disk partition information of the current file system, which is recognized by the kernel.
[Email protected] proc]# cat/proc/partitions
Major Minor #blocks name
8 0 8388608 SDA
8 1 512000 sda1
8 2 7875584 Sda2
253 0 7036928 dm-0
253 1 835584 dm-1
Finish!
The root is recorded in the kernel, the file is present on the disk, the kernel starts to take the root as an outside access, the disk is mounted to the kernel, the user can access the data on the disk
The file system belongs to the kernel, which defines the root. The bootloader of the MBR locates the operating system boot according to the information of the metadata area, after the kernel starts, creates the root in the kernel, as the outside access entrance.
When the disk is formatted, it divides the disk into the metadata area and the data area, as long as it can be found in the metadata area, it can be the location of all the data, that is bootloader find the operating system storage location method.
The root of the filesystem is on the kernel, the file system's entry, and the directory is on disk, such as bin.
The execution file required for kernel boot must be placed on the root partition, because the kernel will only mount the root partition to the kernel when it boots, for example/bin,/sbin,/lib,/etc
Files from other partitions need to be mounted to the root through the primary partition
/bin,/sbin
/usr/bin,/usr/sbin,/usr/local/bin,/usr/local/sbin
/lib,/lib64,/usr/lib,/usr/lib64
/etc/
/media,/mnt
/dev
/proc,/sys
/home,/root
/var
/OPT,/misc
/srv
/tmp
/boot
/usr
Fdisk, Sfdisk, parted
[Email protected] proc]# fdisk-l/DEV/SDA
disk/dev/sda:8589 MB, 8589934592 bytes
255 heads, Sectors/track, 1044 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x000eb87f
Device Boot Start End Blocks Id System
/DEV/SDA1 * 1 512000 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 1045 7875584 8e Linux LVM
* Indicates a boot file, such as kernel
Start and end refer to the size of the cylinders, from the beginning to the end of the position
VFS: Virtual file system, which allows Linux to support multiple file systems, and can be unified command for a higher layer
File system:
Basic filesystem: Ext2, Ext3, EXT4, Reiserfs (good for small files), XFS (very good for single large file support), JFS, VFAT, NTFS
Swap partition: Swap
Cluster file system: GFS2, OCFS2
Network File system: NFS, Smbfs (CIFS)
Disc: iso9660
Raw
Fdisk/dev/sda
D: Delete partition
N: New Partition
P: Lists the information on the disk, the partition on the current disk
T: Adjust partition ID, file system type
L: Lists the kernel-supported partition IDs, which are the kernel-supported file systems
W: Save exit
Q: Do not save exit
The following two instructions, after partitioning the disk, feel that using Fdisk on the/DEV/SDA operation, that is, the operation of the disk device files, make the partition, and then use the following instructions, so that the kernel to identify the partition.
The starting disk may not be fully used, only the partition under which it is made can be used, and partitions make the rest of the disk space available for use.
CentOS 5:partprobe
CentOS 6:partx, Kpartx
In 6, the following three instructions can be used repeatedly to complete the operation, compare shit
Kpartx-l/DEV/SDA
Kpartx-af/dev/sda
Partx-a/DEV/SDA
Learning Logs---Linux disk-to-kernel relationships and partitioning