In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
This article is to share with you an introduction to the basics of Linux disks. The editor thought it was very practical, so I shared it with you to learn. The following information is about the basics of Linux disks.
I. disk basis 1. Disk structure
Hard disk storage capacity = number of heads x tracks (cylinders) x number of sectors x bytes per sector
Cylinder / head / sector can be used to uniquely locate each area on the disk 1) the physical structure of the hard disk
Disk: a hard disk has multiple disks, each with 2 sides
Magnetic head: one magnetic head on each side; 2) data structure of hard disk
Sector: the disk is divided into multiple sector areas, each of which stores 512 bytes of data
Track: concentric circles with different radii of the same disk
Cylinder: a cylinder composed of different disks with the same radius; 3) disk interface type
IDE (parallel port): basically eliminated
SATA (serial port): high speed, strong error correction ability, the current mainstream interface, widely used
SCSI: fast speed, low CPU footprint, hot-swappable; 4) MBR master boot record
MBR (Master Boot Record) is located in the first physical sector of the hard disk; the MBR contains the main boot program of the hard disk and the hard disk partition table; the partition table has four partition recording areas, each of which occupies 16 bytes.
2. Disk partition representation
Hard drives, partitions and other devices are represented as files in Linux.
IDE:/dev/hda5, the sequence number of the hard disk is represented by APCZ, the sequence number of the partition is expressed by a number, 1: 4 represents the primary partition, and 5 is represented as the logical partition. The computer has a total of two IDE interface disks.
SATA,SCSI:/dev/sdb2, the computer has a total of three hard drives with SATA or SCSI interfaces.
Examples of applications are as follows:
1. Disk partition structure
There are only 4 primary partitions in the hard disk, so the serial number of the primary partition and the extended partition is limited to 1: 4. The extended partition is subdivided into logical partitions, and the serial number of the logical partition will always start from 5. As shown in the following figure:
2. File system type 1) XFS file system
Partitions for storing file and directory data, high-performance journal file systems, and file systems used by default in CentOS 7 systems.
2) SWAP Exchange File system
Establish a swap partition for the Linux system.
3) EXT4 4th Generation extension (Extended) file system
The partition that holds file and directory data, the typical journal file system, and the file system used by default in the system.
4) other file system types supported by Linux
FAT16 、 FAT32 、 NTFS 、 XFS 、 JFS.
3. Plan hard disk partition 1, detect and confirm new hard disk 1) detect and confirm the basic syntax format of new hard disk is as follows:
The output information is described as follows:
Examples of applications are as follows (listing the information of all hard disk devices and their partitions in the current system): [root@centos01 ~] # fdisk-l disk / dev/sda:85.9 GB, 85899345920 bytes 167772160 sector Units = sector of 1 * 512 = 512 bytes sector size (logical / physical): 512byte / 512byte I Zero size (min / optimal): 512byte / 512byte disk label type: dos disk identifier: 0x000ab7bb device Boot Start End Blocks Id System/dev/sda1 * 2048 411647 204800 83 Linux/dev/sda2 411648 8800255 4194304 82 Linux swap / Solaris/dev/sda3 8800256 167772159 79485952 83 Linux disk / dev/sdb:42.9 GB 42949672960 bytes 83886080 sector Units = sector of 1 * 512 = 512 bytes sector size (logical / physical): 512byte / 512byte I size (minimum / optimal): 512byte / 512byte 2, Planning Partition in hard disk 1) Planning the role of hard disk partitions and grammatical format
Used to manage disk partitions in an interactive operating environment, the basic syntax format for planning hard disk partitions is as follows:
2) Application examples are as follows: [root@centos01 ~] # fdisk / dev/sdb Welcome to fdisk (util-linux 2.23.2). The changes remain in memory until you decide to write them to disk. Think twice before using the write command. Command (enter m for help): the m command operates a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition g create a new empty GPT partition table G create an IRIX (SGI) partition table l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel T change a partition's system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only) 3) commonly used instructions in fdisk interaction mode
M: view the help information of the operation instruction
P: list to view partition information
N: create a new partition
D: delete partition
T: change the partition type
W: save partition settings and exit
Q: abandon the partition setting and exit; 3) Planning the partition case in the hard disk
Add a new SCSI hard disk of 40GB for the host
Partition the hard disk: divide it into 3 primary partitions, each 5GB
The remaining space is an extended partition, and two logical partitions with the capacity of 5GB and 10GB are established in the extended partition.
Change the type of the first logical partition to swap and the type of the second logical partition to lvm volume
Confirm the partition setting and save the exit
The case application is as follows:
[root@centos01 ~] # fdisk / dev/sdb Welcome to fdisk (util-linux 2.23.2). The changes remain in memory until you decide to write them to disk. Think twice before using the write command. Command (enter m for help): n Partition type: P primary (0 primary, 0 extended, 4 free) e extendedSelect (default p): P partition number (1-4, default 1): start sector (2048-83886079, default is 2048): the default 2048Last sector will be used, + sector or + size {Kje MMagg} (2048-83886079) Default is 83886079): + 5G partition 1 has been set to Linux type, size set to 5 GiB command (enter m for help): n Partition type: P primary (1 primary, 0 extended, 3 free) e extended Select (default p): P partition number (2-4, default 2): start sector (10487808-83886079) Default is 10487808): the default 10487808Last sector will be used, + sector or + size {K Magna M extendedSelect G} (10487808-83886079, default is 83886079): + 5G partition 2 has been set to Linux type, size set to 5 GiB command (enter m for help): nPartition type: P primary (2 primary, 0 extended, 2 free) e extendedSelect (default p): P partition number (3404, default 3): start sector (20973568-83886079) Default is 20973568): the default 20973568Last sector will be used, + sector or + size {K Magna M extendedSelect G} (20973568-83886079, default is 83886079): + 5G partition 3 has been set to Linux type, size set to 5 GiB command (enter m for help): n Partition type: P primary (3 primary, 0 extended, 1 free) e extendedSelect (default e): e partition 4 start sector (31459328-83886079) Default is 31459328): the default 31459328Last sector will be used, + sector or + size {K _ MagneM _ G} (31459328-83886079, default is 83886079): the default value 83886079 partition 4 has been set to Extended type, size is set to 25 GiB command (enter m for help): n All primary partitions are in use add logical partition 5 starting sector (31461376-83886079) Default is 31461376): the default 31461376Last sector will be used, + sector or + size {K Magna M Magi G} (31461376-83886079, default is 83886079): + 5G partition 5 has been set to Linux type, size set to 5 GiB command (enter m for help): n All primary partitions are in use add logical partition 6 start sector (41949184-83886079) Default is 41949184): the default 41949184Last sector will be used, + sector or + size {K _ MagneM _ G} (41949184-83886079, default is 83886079): + 10G partition 6 has been set to Linux type, size is set to 10 GiB command (enter m for help): t partition number (1-6) Default 6): 5 Hex code (enter L to list all codes): 82 changed the type of partition "Linux" to "Linux swap / Solaris" command (enter m for help): t partition number (1-6) Default 6): 6 Hex code (enter L to list all codes): 8e changed the type of partition "Linux" to "Linux LVM" command (enter m for help): P disk / dev/sdb:42.9 GB, 42949672960 bytes 83886080 sector Units = sector of 1 * 512 = 512 bytes sector size (logical / physical): 512byte / 512byte I size (min / best): 512byte / 512byte disk label type: dos disk identifier: 0xd91b1f6f device Boot Start End Blocks Id System/dev/sdb1 2048 10487807 5242880 83 Linux/dev/sdb2 10487808 20973567 5242880 83 Linux/dev/sdb3 20973568 31459327 5242880 83 Linux/dev/sdb4 31459328 83886079 26213376 5 Extended/dev/sdb5 31461376 41947135 5242880 82 Linux swap / Solaris/dev/sdb6 41949184 62920703 10485760 8e Linux LVM command (enter m for help): w The partition table has been altered calling ioctl () to re-read partition table.WARNING: Re-reading the partition table failed with error 16: set Busy with preparation or resources. The kernel still uses the old table. The new table will be used atthe next reboot or after you run partprobe (8) or kpartx (8) is synchronizing the disk.
After reading the above, do you have any further understanding of Linux disks? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel. Thank you for reading.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.