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

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Liunx disk Management

1. First hard disk / dev/sda second block / dev/sdb third block / dev/sbc

It is not common to install RAID,LVM before installing the system.

Partition-> format-> mount disk

First partition / dev/sda1, and so on

2. Disk classification: mechanical disk, solid state disk

3. Free-m query memory

The real memory of the system is buffers/cache

Buffers is a write buffer, and sync writes buffers buffer data to disk

Cache is cached for readout, and the data on disk is read out and saved in cache.

2. Mainstream servers in production environment

Mainstream servers of Internet companies: Dell, IBM, HP

Mainstream disks: SAS, SATA, SSD hard drives

1) Enterprise SAS hard disk: 15000 rpm-300g, 600g, 1p.

A business server used to provide ordinary external services on a production line.

For example: database business on the production line, storage business, picture business and related high concurrency business, there is no special business requirements, SAS disk is the first choice.

2) Enterprise SATA hard disk: 7200-10000 rpm / min, common capacity 1T/2T, large affordable capacity

Mainly apply data storage that does not provide services offline or business applications with high concurrency and low traffic

Not as good as: site programs and databases, offline backup of pictures, etc.

3) SSD solid state disk:

Small capacity and high price

Summary:

1. For online business (providing external services), choose SAS hard disk.

2. Offline business (no external service is provided), use SATA hard disk.

3. Online high concurrency and small capacity business, SSD hard disk.

4. Analyze the hierarchical storage intelligently according to the access heat of the data. (SATA+SSD)

Pay special attention to:

Never use SATA hard drive to do online high concurrency service or database business. This is a bloody lesson:

A company uses SATA as the storage disk of the database, resulting in a continuous downtime of the database for one month.

Solution: change the disk from SATA (RAID5) to SAS (RAID10)

Linux disk Base:

Disk-- disk Head-- head Sector- sector Track- track Cylinder- cylinder

Units- unit block Block- data block Inode- index node

The MBR master boot record includes:

Master boot record (446 bytes) + partition table (64 bytes) + end identification (2 bytes)

Partition tables: four partition tables, each with 16 bytes.

Dd if=/dev/sda of=mbr.bin bs=512 count=1

File mbr.bin

Od-xa mbr.bin to view MBR content

Disk partition

1) the essence of disk partitioning is to set the 64-byte partition table of track 1 sector, partition tool fdisk (2T disk across the river and light rain), parted (suitable for disks larger than 2T, you can partition disks less than 2T).

2) the partition of a disk is only 64bytes size, and only four partition table information (main + extended partition) is supported.

3) the smallest unit of disk partition is cylinder.

4) extended partitions cannot be used directly, and logical partitions need to be created.

5) the extended partition has its own partition table, so there can be multiple logical partitions under the extended partition. Disks generally need to be partitioned before use, of course, it is no problem if they are not partitioned and formatted directly, but this is not a common situation.

6) A disk can have up to four partition information (the limitation of the disk itself).

Primary partition Primary

Generally speaking, the primary partition is the partition that must exist on the disk, usually the first partition of the disk, and the operating system can be installed on the primary partition.

We install the system:

/ boot primary partition

Swap primary partition

/ main partition

/ data primary partition

Extended Partition:

Strictly speaking, the extended partition cannot be regarded as a normal partition, but a link that points to it. We can establish a logical partition within the extended partition. The extended partition is like a small virtual hard disk. The difference is that there is no MBR, but only the extended partition table, and the extended partition table does not have the restrictions of 64bytes, so you can divide multiple logical partitions in the extended partition.

Only one extended partition can exist in a hard disk, and the extended partition can not store data directly, and the extended partition is limited by the operating system.

Logical partitioning:

The logical partition cannot be divided directly on the disk and must exist in the extended partition. Multiple logical partitions can be divided in the extended partition. The port of the logical partition starts from the number 5. In this extended partition, multiple logical partitions can be divided (the IDE disk number can be 5-63) and SATA (number 5-15).

Note:

Due to the limitations of MBR and disk partition table size, if 4p or 3P+E is allocated to the disk, even if the disk still has unallocated space, then this space cannot be used by the partition because there is no partition to be divided, and the partition table space is full. Therefore, when doing partition planning, if the business needs, it is clear that there are more than 4 partitions before the partition, then you can choose the partition method of 3P+E, and all the remaining space is allocated to this expansion partition in the last expansion partition, of course, you can also use the partition method of 1Please E and 2P partition.

Description:

1. The extended partition is not a real available partition. After the extended partition is established, it is necessary to establish a logical partition on top of the extended partition before it can be used.

2, for the primary partition and logical partition general data storage use no difference (for most data stores), in the installation of the operating system is the first partition to choose the primary partition.

3, partition number 1-4 is reserved for primary partition or extended partition, logical partition number can only start from 5, even if 1-4 partition has surplus, lattice logical partition will not be assigned.

4. Partitioning the hard disk is actually modifying the partition table (Partitiontable) of the hard disk, that is to say, we are actually changing the 64-byte partition table through fdisk partitioning, and the partition has nothing to do with the corresponding data. Therefore, in theory, resizing the partition does not delete the data within the partition.

Special note: the disk can be formatted without partitioning, but this is not recommended.

The easier it is to be an operation and maintenance worker.

Common partitions:

1. General zoning

/ boot 100M

1.5x swap

/ remaining disk size

2. DB and storage: there is a lot of data

/ boot 100M

/ 50-200g

Swap 1.5x memory

/ data the size of the remaining hard disk that stores the data

3. Large web portals

/ boot 100m Primary Partition

/ swap 1.5x main memory partition

/ 20-200g

No longer partition, keep, in the future which will be redivided according to the needs of their own-flexibly expand the partition

Why is a sector only 512 bytes, why not 1024 bytes?

Standards defined by all vendors

LVM has poor performance and is not recommended.

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

Wechat

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

12
Report