Introduction to Linux ephemeral disks (hard disks)

Source: Internet
Author: User

This article attempts to introduce the basic knowledge of local disks in Linux from the hardware structure and logical structure. 1. hardware structure a disk consists of multiple disks, each of which has a corresponding head (heads). We can store the required information on this disk. Each disc is divided into multiple rings, which are called cylinders ). Each cylinder is divided into multiple slice areas (sectors). For details, see: a cylinder is located between two red rings. The yellow part in the figure is a slice. 2. fdisk-l view Disk status # fdisk-l Disk/dev/sda: 73.2 GB, 73274490880 bytes 255 heads, 63 sectors/track, 8908 cylinders Units = cylinders of 16065*512 = 8225280 bytes Device Boot Start End Blocks Id System/dev/sda1 * 1 16 128488 + 83 Linux/dev/sda2 17 1928 15358140 83 Linux/ dev/sda3 1929 2189 2096482 + 82 Linux swap/Solaris/dev/sda4 2190 8908 53970367 + 5 Extended/dev/sda5 2190 2450 2096451 82 Li Nux swap/Solaris/dev/sda6 2451 2711 2096451 82 Linux swap/Solaris/dev/sda7 2712 2972 2096451 82 Linux swap/Solaris/dev/sda8 2973 8908 47680888 + 83 Linux www.2cto.com see, the above Disk/dev/sda has 255 heads and 8908 cylinders. Each cylinder track has 63 sectors. Because the size of each slice is 512 bytes, the total size is about 8908*63*512*255 = 73270794240 (73274490880 different from the above 3696640, ). 3. for more information about disk partitions, file systems, and mount points, see the example above. Disks/dev/sda are divided into eight partitions:/dev/sda1, /dev/sda2 ,......, /dev/sda8, Start and End are the Start and End columns of each partition respectively. For example, if the partition/dev/sda2 starts from the cylinder 17 to the end of the cylinder 1928, the size is about (1928-17) * 63*512*255 = 14.6G. You can use df-h to view the Mount directory of the partition/dev/sda2: # df-h Filesystem Size Used Avail Use % Mounted on/dev/sda2 15G 13G 1.1G 92% // dev/sda1 122 M 20 M 96 M 17%/boot tmpfs 2.0G 669 M 1.4G 33%/dev/shm/dev/sda8 45G 26G 17G 62%/u01 can be seen, partition/dev/sda2 mount the root directory. Then, view the file system of the partition through the file/etc/fstab: # more/etc/fstab LABEL = // ext3 defaults 1 1 LABEL =/boot1/boot ext3 defaults 1 2 devpts/dev/pts devpts gid = 5, mode = 620 0 0 tmpfs/dev/shm tmpfs defaults 0 0 proc/proc defaults 0 0 sysfs/sys sysfs defaults 0 0 LABEL =/u01/u01 ext3 defaults 1 2 LABEL = SWAP-sda5 swap defaults 0 0 LABEL = SWAP-sda6 swap defaults 0 0 LABEL = SWAP-sda7 swap defaults 0 0 LAB EL = SWAP-sda3 swap defaults 0 0 www.2cto.com to see the root directory/use the Linux ext3 file system. Now, we can see that the disk/dev/sda is divided into eight partitions. The second partition/dev/sda2 ends from the cylinder 17 to the cylinder 1928, with a size of about 15 GB. The partition is mounted to the root directory/and uses the ext3 file system. 4. For other disk partitions, we can see a total of eight disk partitions in the fdisk-l list above. I have analyzed/dev/sda2 above. Let's look at other partitions. In Linux, the first partition/dev/sda1 is mounted to/boot as the boot sector. The second partition is mounted to the root directory/. The size is 15 GB, the third partition of the ext3 file system is the swap partition, ranging from 1929 to 2189 on the cylindrical surface. The size is about (2189-1929) * 63*512*255 = 2G. The fourth partition is an extended partition, and the last four partitions are all part of the partition. The partition ends from the cylindrical surface 2190 to 8908. Partitions 5, 6, and 7 are the subpartitions of the extended partitions. They are all swap partitions and the size of a single partition is 2 GB. Therefore, the size of all swap partitions is 2G + 2G * 3 = 8G. The eighth partition is the last subpartition of the extended partition. It is mounted on/u01 and the size is about (8908-2973) * 63*512*255 = 45G. The preceding figure shows all the disk partitions and mounting conditions on the instance host. 5. summary with the above information, we have basically understood the hardware structure and the corresponding logical structure, and few commands are required: # fdisk-l # df-h # more/etc/fstab6. supplement # This file is edited by fstab-sync-see 'man fstab-sync' for details LABEL =/1/ext3 defaults 1 1 LABEL =/boot1/boot ext3 defaults 1 2 ...... www.2cto.com simple supplement to/etc/fstab: the first column is: Usually the device (partition), if there is also a LABEL = ×××, this is ext2 ext3 unique volume LABEL, you can use e2label to view the volume labels of each device. The second column is: mount point Column 3: File System Column 4: parameters during file system mounting (for example, NFS sometimes requires user name and password) Column 5 is: indicates whether Backup 1 is required, 0 is not required, and column 6 is: whether to use fsck to check if Disk 1 is checked first, and 2 is checked later, 0 indicates that the first column in the fstab file is none, which is a file system that does not require a physical disk. Typical Example:/proc file system: none/dev/shm tmpfs defaults 0 0 none/proc defaults 0 0 0 none/sys sysfs defaults

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.