In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Disk management in Linux the learning of disk management in Linux is mainly divided into three parts: partition format mount 1, disk structure
Hard disk is one of the commonly used storage devices for computers. This chapter will introduce the basic knowledge of hard disk.
Hard disk logistics structure disk: the disk has multiple disks, each disk has two heads: the data structure of each head hard disk: the data structure sector of the hard disk: the disk is divided into multiple sector areas, each sector stores 512 bytes of data tracks: concentric cylinders with different radii of the same disk: cylinders composed of different discs with the same radius
Hard disk storage capacity = number of heads x tracks (cylinders) x number of sectors x bytes per sector
For example, a disk is a disk with 3 disks, 6 heads and 7 cylinders (7 tracks per disk). In figure 3, each track has 12 sectors, so the capacity of this disk is:
Storage capacity 6 7 12 * 512 = 258048
The number of sectors of each track is the same as the old hard disk, the density of the outer ring is small, the density of the inner ring is high, and the amount of data that can be stored in each circle is the same. The density of the new hard disk data is the same, so that the longer the perimeter of the track, the more sectors and the greater the amount of data stored. You can use cylinders / heads / sectors to uniquely locate each area on the disk, and use fdisl-l to view partition information:
Disk interface type IDE parallel port SATA serial port SCSI minicomputer system interface disk partition represents master boot record (MBR:MAster Boot Record) MBR is located in the first physical sector of the hard disk MBR contains the hard disk master boot program and the hard disk partition table partition table has four partition recording areas, each partition recording area occupies 16 bytes, the hard disk, partition and other devices represent files in Linux
Hd:IDE interface
SD:SCSI interface
A stands for the first hard drive
5: logical partition disk partition structure there are only four primary partitions in the hard disk, so the sequence number of the primary partition and the extended partition is limited to 1: 4. The sequence number of the logical partition subdivided into logical partitions will always start at 5.
File system type XFS file system stores file and directory data partitions file system SWAP used by default in high-performance journal file system CentOS7 system, swap file system establishes swap partition for Linux system other file system types supported by Linux FAT16, FAT32, NTFSEXT4, JFS III, detect and confirm new hard disk fdisk command to view or manage disk partition
The commonly used commands m, p, n, d, t, w, qm in fdisl-l [disk device] or fdisk [disk device] interactive mode indicate help information p indicates display partition list
N means to create a partition, such as two primary partitions
Follow a similar procedure to continue to create a second primary partition (/ dev/sdb2), and the capacity is also specified as 20GB. After completion, you can enter the "p" instruction to view the partition, as follows:
Create an extended partition and two logical partitions, use the remaining hard disk space to create an extended partition, and then create a logical partition in the extended partition. It should be noted that if both the primary partition and the logical partition have been created (the four primary partition numbers have been used up), the partition category will no longer be prompted after entering the "n" instruction again. First, use all the remaining space to create an extended partition (/ dev/sdb4) (after all the space has been allocated, a new primary partition cannot be created), as follows:
Next, create the first logical partition (/ dev/sdb5) in the extended partition, with the capacity specified as 2GB, as shown below:
Then follow a similar procedure to continue to create a second logical partition (/ dev/sdb6) with the capacity specified as 10GB. After completion, you can enter the "p" instruction again to view the partition, as follows:
D means to delete a partition
T indicates that the conversion partition type is converted by ID
The ID numbers for the most commonly used XFS and Swap file systems are 83 and 82, respectively, while the ID number for NTFS file systems used in Windows is generally 86. Do the following to change the type of logical partition "dev/sdb5" to Swap, and confirm that the partition ID of partition / dev/sdb5 has changed from the default 83 to 82 through the "p" instruction. As shown in the figure:
W means to save changes
Q means to quit. 3. Create a file system
Mfks command
Make Filesystem, create file system (formatted) mkfs-t file system type partition device
Execute the following command "/ s _ mkfs _ MKFS *" to view the tools related to the SQL command in the current operating system.
Create a XFS file system when you need to create a XFS file system, simply specify the type with the "- t xfs" option and specify the partition device to be formatted. For example, doing the following will format the partition / dev/sdb1 as a XFS file system.
Mkswap command make swap, create swap file system mkswap partition device swapon add swapoff unmount
For the newly added swap partition, you need to use the swapon command to enable it, while the swapoff command is used to deactivate the specified swap partition. For example, the following shows the process of enabling and deactivating swap partition / dev/sdb5, as well as the change in the total swap space.
Mount and unmount system files mount command mount file system, ISO image to specified file mount [- t type] storage device mount point directory mount-o loop ISO image file mount point directory
Among them, the file system type can be omitted (automatically identified by the system), the storage device is the device document name of the corresponding partition (such as / dev/sdb1, / dev/cdrom) or the network resource path, and the mount point is the directory specified by the user for mount. For example, the following action is used to mount the CD device to the / media/cdrom directory.
Umount command unmount mounted file system umount storage device location umount mount point directory
Set file system auto-mount / etc/fsdtab configuration file contains file system records that need to be automatically mounted after boot
[root@localhost ~] # vi / etc/fstab
. / / omit part of the content
/ dev/sdb1 / mailbox xfs defaults 0 0
Device name mount point file system type functional permissions whether disaster recovery backup startup sequence check 0Person1Phone2
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.