Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Linux disk management and file system

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Preface

The concept of zoning:

Partition is essentially a kind of formatting of hard disk. When we create the partition, we have set the physical parameters of the hard disk and specified the location of the hard disk master boot record (that is, MasterBootRecord, generally referred to as MBR) and the backup of the boot record. The information needed for the file system and other operating systems to manage the hard disk is achieved through later advanced formatting, that is, the Format command. After partitioning the Side, track, and sector hard disk, it will be divided into face (face), track (Track), and sector (Sector). It is important to note that these are only virtual concepts, not really track on the hard drive.

Introduction to MBR:

MBR (Main Boot Record master reference record) is located in track 0, track 0, cylinder 1, sector 1 of the entire hard disk. However, out of a total of 512 bytes in the main boot sector, MBR takes up only 446 bytes, the other 64 bytes are given to DPT (the Disk Partition Table hard disk partition table), and the last two bytes "55, AA" are the end of the partition. This whole constitutes the main boot sector of the hard disk.

The principle of zoning:

The master boot record consists of three parts: one is the operating system boot code (MBR) of 446byte, and the other is the main partition table (DPT) of 64byte.

The primary partition table records partition information for up to four primary partitions. Each partition occupies 16byte. Partition is to modify the partition table, which does not affect the memory on the hard disk.

Stored data. The last 2 bytes is the end flag.

Expansion technology: a hard disk needs to be divided into more partitions, and more than 5 partitions can be divided into up to one of the four main partitions

Change the zone type to an extended partition, and then create a logical partition in the extended partition. The partition information of a logical partition is stored in an extended partition, which is called expansion.

Exhibition division table. In theory, there is no limit to the number of logical partitions. Extended partitions cannot be used directly and must be divided into several logical partitions.

The information about the starting position of the logical partition is written in the extended partition table. The partition number of a logical partition starts at 5, for example: / dev/hda5 is the first

The first logical partition of a hard disk.

Formatting principle:

There is no data on the partitioned hard disk partition, and the operating system cannot read or write. In order for the operating system to recognize that a certain format of data must be pre-written to the partition. This process is called formatting. In Linux, it is called creating a file system. Hard drives without partitions cannot be formatted, and partitions without formatting cannot be used directly. So partitioning and formatting are often done at the same time.

The structure of this chapter

Disk base detect and confirm the partition in the new hard disk planning hard disk to create a file system mount and unmount the file system

I. disk structure

Physical structure of hard disk: hard disk has multiple disks, no disk on both sides of the head: one head on each side

The data structure sector of the hard disk: the disk is divided into several sector-shaped areas, each of which stores 512 bytes of data track: concentric cylinders with different radii of the same disk: cylinders composed of different disks with the same radius

Hard disk storage capacity = number of heads x tracks x number of sectors x bytes per sector

Cylinders / heads / sectors can be used to uniquely locate each area on the disk

Disk interface type IDE (parallel port) SATA (serial port) SCSI

Second, MBR and disk partition representation

The master boot record (MBR:Master Boot Record) MBR is located in the first physical sector of the hard disk, MBR, which contains the main boot program of the hard disk and the partition table of the hard disk. The partition table has four partition record areas, each of which occupies 16 bytes.

Hard drives, partitions and other devices are represented as files in Linux

MBR up to four partitions (physical sectors)

GPT can have 128partitions

Hd stands for IDE device

Sd stands for SCSI device

III. File system type

XFS file system

Partitioned, high-performance, journal file system that holds file and directory data. File system used by default in CentOS 7 systems

SWAP, swap file system establish swap partition for Linux system

Other file system types supported by Linux FAT16,FAT32,NTFSEXT4,JFS.

Check and confirm the new hard drive

Fdisk command: view or manage disk partitions

Fdisk-l view hard disk information

Fdisk-m view help information

-n create a new partition

-d Delete

-t conversion format

-w save

-Q exit

Mkfs command: create file system, format

Mount mount command! [] 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 uninstalls files that have been mounted

/ etc/fstab configuration file, which contains the file system records that need to be mounted automatically after boot

/ dev/sdb1 / mailbox xfs defaults 0 0

Partition mount point file system type permission function disaster recovery sequence

Overview of LVM logical Volume

LVM logical volume management

Dynamically adjust disk capacity to improve the flexibility of disk management / boot partitions are used to store boot files, and a graphical interface management tool system-config-lvm cannot be created based on LVM

Main command

Pvcreate device name 1 [device name 2.]

Vgcreate volume group name physical volume name 1 physical volume name 2

Lvcreate-L capacity size-n logical volume name volume group name

Lvextend-L + size / dev/ volume group name / logical volume name

Summary

Linux disk management and file system let us know more about Linux. The content is not too much, nor is it difficult to understand, there are still new commands for us to remember, just remember the basic commands and grammar.

The establishment of LVM logical volume ah, find a few command rules can be easily remembered. Command, grammar is still a very important and the most basic link, we must knock more practice to consolidate!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report