1. df command to view partition usage common options-h,-m2, du command to view file directory size common options: -h [humanity] du-hhomexiaofang-s [statistics] du-shetc3, detection of repair file system fsck [file1_e 1, df command to view partition usage
Common options-h,-m
2. run the du command to view the file/directory size.
Common options:
-H [humanity]
Du-h/home/xiaofang
-S [statistics]
Du-sh/etc
3. check and repair the file system fsck [file system check] and e2fsck 【]
Function: similar to Windows blue screen detection, fsck is automatically called to detect and fix the file system in case of abnormal power outages.
Usage: e2fsck directly lists common options.
4. file command to determine the file type
File/etc/services
[Case analysis]
I. use the optical drive
1. mount the optical drive
Mount/dev/cdrom/mnt/cdrom mounting optical drive
Df-h view mounting information
Cd/mnt/cdrom
2. uninstall the optical drive
Umount/mnt/cdrom [Mount point]
Or eject // the optical drive will pop up when the eject is detached.
2. add a hard disk or partition
1. add a hard disk. Generally, the system will be powered off on the real server]
2. restart the system
3. enter the CMOS/BIOS mode to check whether the new hard disk can be detected.
4. you can also check whether this hard disk can be detected after Linux is started.
Dmesg | grep sdb
5. Partitions
[Fdisk-l/dev/sda view the first hard disk information]
Fdisk/dev/sdb command to partition the new hard disk
M for help
P prints the current partition information and displays the partition table
N add a new partition
You can add (1) e 1 extended partition, including several logical partitions
(2) p-4 primary partitions
T. change the file system type of the new partition.
Commonly used are 83Linux and 82 Linux swap/
[Default file system type: ext3]
D. delete the system partition.
W save and exit, and write to the partition table
Q: Do not save and exit
6. create a file system after restarting [similar to Windows formatting]
Note: If you want to save data in any partition, you must use a data management method. this method is called a file system. for example, Windows is NTFS. [disk quota is supported, file compression, or FAT32; Linux is ext3
For the ext3 file system: mkfs. ext3 [or mkfs-t ext3]
Mkfs. ext3/dev/sdb1 // note the writing mode
Option:-B indicates the size of the data block. [other options can be viewed through man mkfs. ext3]
7. create an empty directory by mkdir/web //. the directory must be empty. otherwise, all data will be cleared later.
8. Mount
Mount/dev/sdb1/web