Linux Learning Essay-Disk Management

Source: Internet
Author: User

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 subdirectories du-a + Directory lists directory subdirectories and file sizes Common Du-sh + Table of contents indicates the sum is listed in the appropriate units 2: Disk partitioning fdisk-l List all current partition conditions disk/dev/sdb:8589 MB, 8589934592 bytes 255 heads, Sectors/track, 1044 cylinders Units = Cylinders of 16065 * 8225280 bytes Sector Size (logical/physical): bytes/512 bytes I/O size (minimum/optimal): bytes/512 bytes Disk identifier:0x00000000 you can see that/dev/sdb is a new piece of disk that has not been partitioned yet. Input Fdisk/dev/sdb fdisk does not add L can enter another mode to begin partitioning. Enter p to print the current partition condition: Command (M for help): P disk/dev/sdb:8589 MB, 8589934592 bytes 255 heads, Sectors/track, 1044 cylinders Units = Cylinders of 16065 * 8225280 bytes Sector Size (logical/physical): bytes/512 bytes I/O size (minimum/optimal): bytes/512 bytes Disk identifier:0x2543f3b6 Device Boot Start End Blocks Id System as you can see, the partition has not yet been partitioned and the input n is established: disk/dev/sdb:8589 MB, 8589934592 bytes 255 heads, Sectors/track, 1044 cylinders Units = Cylinders of 16065 * 8225280 bytes Sector Size (logical/physical): bytes/512 bytes I/O size (minimum/optimal): bytes/512 bytes Disk identifier:0x2543f3b6 Device Boot Start End Blocks Id System Command (M for help): N Command Action e Extended p 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): +1000m Enter the number of partitions, the location of the partition, the end position is the size Enter P to view: disk/dev/sdb:8589 MB, 8589934592 bytes 255 heads, Sectors/track, 1044 cylinders Units = Cylinders of 16065 * 8225280 bytes Sector Size (logical/physical): bytes/512 bytes I/O size (minimum/optimal): bytes/512 bytes Disk identifier:0x2543f3b6 Device Boot Start End Blocks Id System /dev/sdb1 1 1028128+ Linux creation 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 below disk/dev/sdb:8589 MB, 8589934592 bytes 255 heads, Sectors/track, 1044 cylinders Units = Cylinders of 16065 * 8225280 bytes Sector Size (logical/physical): bytes/512 bytes I/O size (minimum/optimal): bytes/512 bytes Disk 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 partitions MKE2FS- t Specifies the file system type mke2fs-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/sdb5 4: Mount Disk after disk partitioning and formatting, you need to set up a mount point, or directory, to write data to the disk MOUNT/DEV/SDB5 newdir/mount the partition df-h Viewing the mounted directory information Filesystem Size used Avail use% mounted on /dev/mapper/vg_flex-lv_root 18G 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/newdir you can see that the SDB5 partition is mounted successfully 5: Add a line to the/etc/fstab file /dev/sdb5/home/flex/newdir ext4 defaults 0 0 This file lists the partitions that need to be mounted when the system starts UMOUNT/DEV/SDB5 unload the SDB5 mounted partition Mount-a will execute the mount file specified in this file

Linux Learning Essay-Disk Management

Related Article

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.