1.常用命令
查看硬盘的分区 #sudo fdisk -l
查看IDE硬盘信息 #sudo hdparm -i /dev/hda
查看STAT硬盘信息 #sudo hdparm -I /dev/sda 或 #sudo apt-get install blktool #sudo blktool /dev/sda id
查看硬盘剩余空间 #df -h #df -H
查看目录占用空间 #du -hs 目录名
优盘没法卸载 #sync fuser -km /media/usbdisk
2. df du 命令
下面是相关命令的解释:
#df -hl 查看磁盘剩余空间
#df -h 查看每个根路径的分区大小
#du -sh [目录名] 返回该目录的大小
#du -sm [文件夹] 返回该文件夹总M数
3. 查看磁盘情况
#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
4.挂载磁盘
先格式化这个磁盘
#mkfs -t ext3 /dev/vdb
把磁盘挂载到/data 目录
#mount /dev/vdb /data/
设置开机自动挂载
#vim /etc/fstab
添加一条
/dev/vdb /data ext3 defaults 0 0
转:http://blog.csdn.net/xiaoreqing/article/details/51743129