3. Disk Management
3.1 df command
· Mounted disk for viewing the total capacity, used capacity, remaining capacity.
-i: view the usage of inodes
-h: Use appropriate units display
-k: display in KB
-m: display in MB
3.1.2 du command
· Used to view a directory or a file size of the space occupied
Format: du [-abckmsh] [file or directory name]
-a: list represents the size of all the files and directories
-b: B represents the values listed in units of output
-k: output expressed in kilobytes (KB). (The default option without output values are the same)
-m: expressed in MB output.
-h: a system adjustment unit automatically.
-c: indicates the last sum
3.2 disk partitioning and formatting
3.2.1 increase the virtual disk
Add a disk in a virtual machine
3.2.2 fdisk command
fdisk [-l]: list all the disk devices and partition tables
fdisk [-l] [Device Name]: listed in the partition table of the apparatus
Partitioning: fdisk / dev / sdb
m: common commands are listed
p: print current disk partition
n: to create a new partition
w: save
q: quit
d: Delete a partition
ctrl + c to exit to cancel all partitions
The establishment of the primary partition
Delete the primary partition
The establishment of extended partition
Logical partitions: In the extended partition, the mount can be formatted
Extended partition: Do not mount can not be formatted
A disk altogether can be divided into four partitions, partition is not a full four primary partition.
3.3 Format the partition
3.3.1mke2fs、mkfs.ext2、mkfs.ext3、mkfs.ext4和mkfs.xfs
mke2fs commonly used commands
· Used to create the corresponding (ext2) file system
mke2fs [options] [device]
-b: represents the partition size of each data block is set space occupied.
-i: setting indicates the size of the inode
-N: represents the number of inode set
-c: representation before the first test to see if the disk formatting problems. (-C plus speed will be very slow)
-L: represents the pre-partition performance (label)
-J: REPRESENTATION ext3 partition format. (If you do not use mkfs.ext3 format plus -j)
-t: used to specify the type of file system.