Linux File System administration commandsCommon Commands
1. DF command to view the usage of the partition
Common options
-H More Humane
-m displays partition usage in megabytes
Display information:
Mounted on: Mount point
Filesystem: The specific hardware name that corresponds to
2, du command to view the file/directory size, by default in K units
Common options:
-H "Humanity"
Du-h/home/xiaofang
-S "Statistic statistics"
du-sh/etc# View directory size, commonly used
3. Detect and Repair file system fsck "file system check", e2fsck
Features: Similar to Windows blue screen detection, when encountering abnormal power outages and other situations, will automatically call fsck, file system detection and repair, but must be executed in single user mode
Usage: e2fsck# will directly list the commonly used options
4. File type judgment
File/etc/services
File NewFile
using the optical drive
1. Mount the optical drive
Mount/dev/cdrom/mnt/cdrom Mount Optical Drive
DF Viewing mount Information
Cd/mnt/cdrom Open Disc Contents
2. Unmount the optical drive
umount/mnt/cdrom# Note: followed by mount point
or eject/mnt/cdrom# uninstall and eject the optical drive
At this time df-h
Expansion-block devices and character devices
add a hard disk or partition
1, add the hard disk "on a real server, the system will usually first power off"
2. Restart the system
3. Enter Cmos/bios mode to see if the newly added hard drive can be detected
4. You can also check if the hard drive is detected after the Linux system is booted, command
DMESG | grep sdb# If you can see a message similar to the following, it means that [but there is no partition], if no information is identified
You can also use fdisk-l/dev/sdb to view the drive information
5. Partitioning
fdisk/dev/sdb# partitioning a new hard disk command
m Get help [most important]
P Print the current partition information, display the partition table
n Add a new partition
By knocking N, you can display:
You can Add (1) E1 extended partitions and can also contain several logical partitions
(2) P1-4 a primary partition
Then follow the instructions to step-by-step to partition success
Other commands under Fdisk
T change the file system type of the new partition
Commonly used is 83Linux and 82Linux swap/
Types of file systems supported by Linux
d Delete the system partition
W Save exit and write to partition table
Q Do not save exit
6. After reboot [best], create file system "similar to the format of Windows"
Note: Any partition, if you want to save data, must have a way to manage the data, this way, called as a file system, such as Windows is ntfs[support disk quotas, file compression] or fat32;linux is ext3
For ext3 file system: Mkfs.ext3 "or mkfs-t ext3"
mkfs.ext3/dev/sdb1# Note that the name of the partition is written, not the hard disk name
Option:-b Specifies the size of the data block
Other options: Can be viewed through the man MKFS.EXT3/MKFS.EXT4
7, mkdir/test# create an empty directory [mount Point], the directory is empty, or the data will be completely emptied
8. Mounting
Mount/dev/sdb1/test
9, detection, you can see similar to the following information, it indicates that the hard drive mounted successfully
10, how to make every time the system starts, will automatically mount the hard disk, in the following article introduced ...
Linux File System administration Commands (second edition)