View the partition of the hard disk #sudo fdisk -l
View IDE hard disk information #sudo hdparm -i /dev/hda
View STAT hard disk information #sudo hdparm -I /dev/sda or #sudo apt-get install blktool #sudo blktool /dev/sda id
Check the remaining space on the hard disk #df -h #df -H
Check the space occupied by the directory #du -hs The directory name cannot be
uninstalled from the USB disk #sync fuser -km /media/usbdisk
df du command
The following is an explanation of the relevant commands:
df -hl to view the remaining space on the disk
df -h to view the partition size of each root path
du -sh [directory name] Return the size of the directory
du -sm [folder] Return the file The total number of clips
Check disk status
fdisk -l
[root@VM_28_226_centos ~]# fdisk -l
Disk /dev/vda: 8589 MB, 8589901824 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xcd6e8236
Device Boot Start End Blocks Id System
/dev/vda1 * 1 1044 8385898+ 83 Linux
Disk /dev/vdb: 268.4 GB, 268435456000 bytes
16 heads, 63 sectors/track, 520126 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/vdb doesn't contain a valid partition table
Partition the data disk
Execute the " fdisk /dev/vdb " command to partition the data disk;
according to the prompt, enter "n", "p", "1" in turn, press Enter twice, "wq", the partitioning starts, It will be done soon.
Format the disk vdb
mkfs -t ext3 /dev/vdb
or
mkfs -t ext4 /dev/vdb
4. Mount the disk to the /data directory
mount /dev/vdb /data/
5. Set vim to automatically mount at boot
/etc/fstab and
add a
/dev/vdb /data ext3 noatime,acl,user_xattr 1 0
or
/dev/vdb /data ext4 noatime,acl,user_xattr 1 0