1:DF to view the capacity information for mounted disks
-I view the usage of inodes-H displays in the appropriate units-k-m are displayed in K-m units respectively .2:du Viewing a file or directory occupies a space du [-ABCKMSH] [filename directory name]the du + catalog will only list the size of the directory and its subdirectoriesdu-a + Directory lists directory subdirectories and file sizesCommon Du-sh + Table of contents indicates the sum is listed in the appropriate units2: Disk partitioningfdisk-l List all current partition conditionsdisk/dev/sdb:8589 MB, 8589934592 bytes255 heads, Sectors/track, 1044 cylindersUnits = Cylinders of 16065 * 8225280 bytesSector Size (logical/physical): bytes/512 bytesI/O size (minimum/optimal): bytes/512 bytesDisk identifier:0x00000000you can see that/dev/sdb is a new piece of disk that has not been partitioned yet. Input Fdisk/dev/sdbfdisk does not add L can enter another mode to begin partitioning. Enter p to print the current partition condition:Command (M for help): Pdisk/dev/sdb:8589 MB, 8589934592 bytes255 heads, Sectors/track, 1044 cylindersUnits = Cylinders of 16065 * 8225280 bytesSector Size (logical/physical): bytes/512 bytesI/O size (minimum/optimal): bytes/512 bytesDisk identifier:0x2543f3b6Device Boot Start End Blocks Id Systemas you can see, the partition has not yet been partitioned and the input n is established:disk/dev/sdb:8589 MB, 8589934592 bytes255 heads, Sectors/track, 1044 cylindersUnits = Cylinders of 16065 * 8225280 bytesSector Size (logical/physical): bytes/512 bytesI/O size (minimum/optimal): bytes/512 bytesDisk identifier:0x2543f3b6Device Boot Start End Blocks Id SystemCommand (M for help): NCommand Actione Extendedp Primary partition (1-4)enter P (primary partition):Partition Number (1-4): 1First cylinder (1-1044, default 1): 1Last cylinder, +cylinders or +size{k,m,g} (1-1044, default 1044): +1000mEnter the number of partitions, the location of the partition, the end position is the sizeEnter P to view:disk/dev/sdb:8589 MB, 8589934592 bytes255 heads, Sectors/track, 1044 cylindersUnits = Cylinders of 16065 * 8225280 bytesSector Size (logical/physical): bytes/512 bytesI/O size (minimum/optimal): bytes/512 bytesDisk identifier:0x2543f3b6Device Boot Start End Blocks Id System/dev/sdb1 1 1028128+ Linuxcreation of the first partition is complete. Linux supports the creation of up to 4 primary partitions, and if additional partitions need to be created, use the command to delete the 4th partition and select the extended partition when entering n to create a partition. As shown belowdisk/dev/sdb:8589 MB, 8589934592 bytes255 heads, Sectors/track, 1044 cylindersUnits = Cylinders of 16065 * 8225280 bytesSector Size (logical/physical): bytes/512 bytesI/O size (minimum/optimal): bytes/512 bytesDisk identifier:0x2543f3b6 Device Boot Start End Blocks Id System/dev/sdb1 1 1028128+ Linux/dev/sdb2 129 1028160, Linux/dev/sdb3 257 384 1028160 -up Linux/DEV/SDB4 385 1044 5301450 5 Extended/DEV/SDB4 is an extended partition, it is best to allocate the remaining space to the extended partition, the extended partition cannot be formatted, and the primary partition created later is a logical partition that is allocated from the extended partition. when you delete a partition by using the D command, if you delete the extended partition, the following sub-partition, the logical partition, is deleted. after the partition is complete, enter W to save the exit. 3: Formatting partitionsMKE2FS- t Specifies the file system typemke2fs-t EXT4/DEV/SDB5 Specifies that the file system has a default block size of 4KB for EXT4 format. A Linux write file is a block of write, such as writing 1 5k files, there will be 2 blocks. -l Specifies that the label-p specifies a block size of 1024 integer times as:mke2fs-t ext4-l test-b 8192-c/dev/sdb54: Mount Diskafter disk partitioning and formatting, you need to set up a mount point, or directory, to write data to the diskMOUNT/DEV/SDB5 newdir/mount the partitiondf-h Viewing the mounted directory informationFilesystem Size used Avail use% mounted on/dev/mapper/vg_flex-lv_root18G 3.5G 13G 22%/tmpfs 932M 0 932M 0%/dev/shm/dev/sda1 477M 37M 415M 9%/boot/dev/sdb5 973M 1.3M 921M 1%/home/flex/newdiryou can see that the SDB5 partition is mounted successfully5: Add a line to the/etc/fstab file/dev/sdb5/home/flex/newdir ext4 defaults 0 0This file lists the partitions that need to be mounted when the system startsUMOUNT/DEV/SDB5 unload the SDB5 mounted partitionMount-a will execute the mount file specified in this file
Linux Learning Essay-Disk Management