digex 发表于 2007-09-03 14:08

硬盘相关命令


查找硬盘上,大小超过指定值的文件
Linux与solaris各版本均一致
命令:$ find /
-xdev -size +9000000c
-exec ls -l {} \;    或
find / -xdev -size +9000000c

注:   "c" 表示字符,一个字符占用一个字节。1000000c 约为 1 MB。
         
(+) 表示 "大于" 给出的数字。
         
(-) 表示 "小于" 给出的数字。
         
"-xdev" ,避免查找文件系统 Mount Point 下的目录。
         
执行时间:1 ~ 2 s
      
*** 执行结果1:
$ find . -xdev
-size +9000000c
-exec ls -l {} \;
-rw-r--r--    1 slview
slview   173801288月 24 13:15 ./nms/netflow/data/ftbak/ft-v05.2007-08-24.131000+0800
-rw-r--r--    1 slview
slview   173844298月 24 13:20 ./nms/netflow/data/ftbak/ft-v05.2007-08-24.131500+0800
-rw-r--r--    1 slview
slview   174231168月 24 13:25 ./nms/netflow/data/ftbak/ft-v05.2007-08-24.132000+0800
-rw-r--r--    1 slview
slview   179339368月 24 13:30 ./nms/netflow/data/ftbak/ft-v05.2007-08-24.132500+0800
-rw-r--r--    1 slview
slview   204852328月 24 11:30 ./nms/netflow/data/ftbak/ft-v05.2007-08-24.112500+0800
-rw-r--r--    1 slview
slview   172500798月 24 12:45 ./nms/netflow/data/ftbak/ft-v05.2007-08-24.124000+0800
-rw-r--r--    1 slview
slview   172883018月 24 12:50 ./nms/netflow/data/ftbak/ft-v05.2007-08-24.124500+0800
-rw-r--r--    1 slview
slview   173484048月 24 12:55 ./nms/netflow/data/ftbak/ft-v05.2007-08-24.125000+0800
-rw-r--r--    1 slview
slview   172388818月 24 13:00 ./nms/netflow/data/ftbak/ft-v05.2007-08-24.125500+0800
-rw-r--r--    1 slview
slview   180321958月 24 13:35 ./nms/netflow/data/ftbak/ft-v05.2007-08-24.133000+0800
-rw-r--r--    1 slview
slview   193878488月 24 10:35 ./nms/netflow/data/ftbak/ft-v05.2007-08-24.103000+0800
-rw-r--r--    1 slview
slview   197742488月 24 10:40 ./nms/netflow/data/ftbak/ft-v05.2007-08-24.103500+0800
*** 执行结果2:
$ find . -xdev
-size +9000000c
./nms/netflow/data/ftbak/ft-v05.2007-08-24.131000+0800
./nms/netflow/data/ftbak/ft-v05.2007-08-24.131500+0800
./nms/netflow/data/ftbak/ft-v05.2007-08-24.132000+0800
./nms/netflow/data/ftbak/ft-v05.2007-08-24.132500+0800
./nms/netflow/data/ftbak/ft-v05.2007-08-24.112500+0800
./nms/netflow/data/ftbak/ft-v05.2007-08-24.124000+0800
./nms/netflow/data/ftbak/ft-v05.2007-08-24.124500+0800
./nms/netflow/data/ftbak/ft-v05.2007-08-24.125000+0800
./nms/netflow/data/ftbak/ft-v05.2007-08-24.125500+0800
./nms/netflow/data/ftbak/ft-v05.2007-08-24.133000+0800
./nms/netflow/data/ftbak/ft-v05.2007-08-24.103000+0800
./nms/netflow/data/ftbak/ft-v05.2007-08-24.103500+0800
./nms/netflow/data/ftbak/ft-v05.2007-08-24.130000+0800
获取硬盘大小、使用情况
linux rh7.2 6.55(IDE硬盘)
硬盘大小:
# parted
GNU Parted 1.4.16

(parted) p
Disk geometry for /dev/hda: 0.000-19073.486 megabytes
Disk label type: msdos
Minor   
Start       End   Type   
FilesystemFlags
1         
0.031   4000.561primary
ext2      boot
2      
4000.56218002.526primary
ext2      
3   
18002.52719069.343primary
linux-swap
或者:cat
/proc/ide/had/capacity/,数值*512

硬盘参数:
# hdparm -i /dev/hda

/dev/hda:

Model=Maxtor 2B020H1,
FwRev=WAK21R90, SerialNo=B1H6LDAE
Config={ Fixed }
RawCHS=16383/16/63, TrkSize=0, SectSize=0,
ECCbytes=57
BuffType=DualPortCache, BuffSize=2048kB,
MaxMultSect=16, MultSect=16
CurCHS=16383/16/63, CurSects=-66060037,
LBA=yes, LBAsects=39062500
IORDY=on/off, tPIO={min:120,w/IORDY:120},
tDMA={min:120,rec:120}
PIO
modes: pio0 pio1 pio2 pio3 pio4
DMA
modes: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 *udma5
AdvancedPM=yes: disabled (255)
Drive Supports : ataATA-1 ATA-2 ATA-3 ATA-4
ATA-5 ATA-6 ATA-7

IO使用率:
bash-2.05$ iostat -d
Linux 2.4.7-10
(linuxhost)      08/24/2007

Device:      tps
Blk_read/s   Blk_wrtn/s   Blk_read
Blk_wrtn
dev2-0      0.00         0.00         0.00          2          0
dev3-0      1.67         0.10      23.85   942116
223091416
linux rh9.0 6.66(SCSI硬盘)
硬盘大小:
# fdisk -l

Disk /dev/sda: 18.2 GB,
18210037760 bytes
255 heads, 63 sectors/track, 2213 cylinders
Units = cylinders of 16065 * 512 = 8225280
bytes


Device Boot    Start       End   
Blocks   IdSystem
/dev/sda1
*         1      13   
104391   83Linux
/dev/sda2            14      2083
16627275   83Linux
/dev/sda3          2084      2213
1044225   82Linux swap

硬盘参数(hdparm命令无法应用与scsi):
# dmesg

scsi0 : sym53c8xx-1.7.3c-20010512
scsi1 : sym53c8xx-1.7.3c-20010512
blk: queue c256f814, I/O limit 1048575Mb (mask
0xffffffffff)
Vendor: HP 18.2GModel:
MAN3184MP         Rev: HP04
Type:
Direct-Access                     
ANSI SCSI revision: 02
blk: queue c256f614, I/O limit 1048575Mb (mask 0xffffffffff)
sym53c896-0-:
tagged command queue depth set to 8
Attached scsi disk sda at scsi0, channel 0,
id 0, lun 0
sym53c896-0-:
FAST-40 WIDE SCSI 80.0 MB/s (25.0 ns, offset 31)
SCSI device sda: 35566480 512-byte hdwr
sectors (18210 MB)
Partition check:
sda:
sda1 sda2 sda3

IO使用率:
-bash-2.05b$ iostat -d
Linux 2.4.20-8
(e800two)      2007Äê08ÔÂ24ÈÕ

Device:            tps   Blk_read/s
Blk_wrtn/s   Blk_read   Blk_wrtn
dev8-0            0.98         5.19      19.60   
4892406   18473662
(如有多块硬盘,如何与df结果对应?)
turbo linux10 (ia64)
192.168.6.161(SCSI)
硬盘大小:
-bash-3.00# fdisk -l

Disk /dev/sda: 73.4 GB,
73407865856 bytes
255 heads, 63 sectors/track, 8924 cylinders
Units = cylinders of 16065 * 512 = 8225280
bytes

   Device Boot      Start         End      Blocks
IdSystem
/dev/sda1               1      8925   
71687368+eeEFI GPT

硬盘参数(hdparm不适用scsi,dmesg显示数据无意义):
-bash-3.00# more scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00

Vendor: HP 73.4G
Model: ST373453LC       Rev: HPC5

Type:   Direct-Access                  ANSI SCSI revision: 03

-bash-3.00$ iostat -d
Linux 2.6.9-5.13
(HP64)         08/24/2007

Device:            tps   Blk_read/s
Blk_wrtn/s   Blk_read   Blk_wrtn
sda               8.13      
2.11       211.20    4228631
424022912
(可以对应)
turbo linux10 (ia32) 6.77(ide)
硬盘大小:
# fdisk -l

Disk /dev/hda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280
bytes


Device Boot      Start         End      Blocks
IdSystem
/dev/hda1   *         
1      5099    40957686
83Linux
/dev/hda2            5100      6374   
10241437+83Linux
/dev/hda3            6375      6501   
1020127+82Linux swap
/dev/hda4            6502      9729   
25928910    5Extended
/dev/hda5            6502      6514      104391   
bW95 FAT32

硬盘参数:
# hdparm -i /dev/hda

/dev/hda:

Model=ST380021A,
FwRev=3.19, SerialNo=3HV33LG8
Config={ HardSect NotMFM HdSw>15uSec Fixed
DTR>10Mbs RotSpdTol>.5% }
RawCHS=16383/16/63, TrkSize=0, SectSize=0,
ECCbytes=4
BuffType=unknown, BuffSize=2048kB,
MaxMultSect=16, MultSect=16
CurCHS=16383/16/63, CurSects=16514064,
LBA=yes, LBAsects=156301488
IORDY=on/off, tPIO={min:240,w/IORDY:120},
tDMA={min:120,rec:120}
PIO
modes:pio0 pio1 pio2 pio3 pio4
DMA
modes:mdma0 mdma1 mdma2
UDMA
modes: udma0 udma1 udma2 udma3 *udma4 udma5
AdvancedPM=no WriteCache=enabled
Drive conforms to: device does not report
version:

*
signifies the current active mode

IO使用率:
-bash-3.00$ iostat -d
Linux 2.6.9-5.11
(localhost.localdomain)      08/24/2007

Device:            tps   Blk_read/s
Blk_wrtn/s   Blk_read   Blk_wrtn
hda               7.36      59.22       172.86
553842740 1616588512
(可以对应)

sun os 2.8(6.21)
硬盘大小、参数:
bash-2.03# iostat -E
sd6   
Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Vendor: TOSHIBAProduct: DVD-ROM SD-M1401
Revision: 1009 Serial No: 12/20/00
Size: 18446744073.71GB
Media Error: 0 Device Not Ready: 0 No
Device: 0 Recoverable: 0
Illegal Request: 0 Predictive Failure
Analysis: 0
ssd0   
Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Vendor: FUJITSUProduct: MAP3735F SUN72GRevision: 0601 Serial No: 0322Q02GPF漱
Size: 73.40GB
Media Error: 0 Device Not Ready: 0 No
Device: 0 Recoverable: 0
Illegal Request: 0 Predictive Failure
Analysis: 0
ssd1   
Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Vendor: FUJITSUProduct: MAP3735F SUN72GRevision: 0601 Serial No: 0322Q02GPG_a
Size: 73.40GB
Media Error: 0 Device Not Ready: 0 No
Device: 0 Recoverable: 0
Illegal Request: 0 Predictive Failure
Analysis: 0
ssd2   
Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Vendor: FUJITSUProduct: MAP3735F SUN72GRevision: 0601 Serial No: 0322Q02GP9_a
Size: 73.40GB
Media Error: 0 Device Not Ready: 0 No Device:
0 Recoverable: 0
Illegal Request: 0 Predictive Failure
Analysis: 0
ssd3   
Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Vendor: FUJITSUProduct: MAP3735F SUN72GRevision: 0601 Serial No: 0318Q01TVD_a
Size: 73.40GB
Media Error: 0 Device Not Ready: 0 No
Device: 0 Recoverable: 0
Illegal Request: 0 Predictive Failure
Analysis: 0
ssd4   
Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Vendor: FUJITSUProduct: MAP3735F SUN72GRevision: 0601 Serial No: 0322Q02GPJ_a
Size: 73.40GB
Media Error: 0 Device Not Ready: 0 No
Device: 0 Recoverable: 0
Illegal Request: 0 Predictive Failure
Analysis: 0
ssd5   
Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Vendor: FUJITSUProduct: MAP3735F SUN72GRevision: 0601 Serial No: 0318Q01TUW_a
Size: 73.40GB
Media Error: 0 Device Not Ready: 0 No
Device: 0 Recoverable: 0
Illegal Request: 0 Predictive Failure
Analysis: 0
st5   
Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Vendor: HP       Product: C5683A         
Revision: C005 Serial No:    9

IO使用率:
bash-2.03# iostat -d
   
sd6         ssd0          ssd1          ssd2      
kps tps servkps tps serv
kps tps servkps tps serv

0   0    0
47   5112   
0   0    0   
0   0    5
sun os 2.10(x86)6.61/6.62
硬盘大小、参数:
bash-3.00# iostat -E
sd0      
Soft Errors: 1 Hard Errors: 0 Transport Errors: 0
Vendor: TEAC   Product: CD-224E          Revision: 1.9A Serial No:
Size: 0.00GB
Media Error: 0 Device Not Ready: 0 No Device:
0 Recoverable: 0
Illegal Request: 1 Predictive Failure
Analysis: 0
sd2      
Soft Errors: 1 Hard Errors: 0 Transport Errors: 0
Vendor: SEAGATEProduct: ST336607LC       Revision: 0007 Serial No:
Size: 36.70GB
Media Error: 0 Device Not Ready: 0 No
Device: 0 Recoverable: 0
Illegal Request: 1 Predictive Failure
Analysis: 0 bash-3.00

IO使用率:
# iostat -d
   
sd0         sd2         nfs1      
kps tps servkps tps serv
kps tps serv

0   0    0   
1   0    2   
0   0    0

sun os 2.10(富士通) 6.162
硬盘大小、参数:
bash-3.00# iostat -E
sd4      
Soft Errors: 1 Hard Errors: 0 Transport Errors: 0
Vendor: TOSHIBAProduct: DVD-ROM SD-M1711
Revision: 1F05
Serial No:
Size: 0.00GB
Media Error: 0 Device Not Ready: 0 No Device:
0 Recoverable: 0
Illegal Request: 1 Predictive Failure
Analysis: 0
sd15   
Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Vendor: FUJITSUProduct: MAP3735NC      Revision: 3701 Serial No:
Size: 73.49GB
Media Error: 0 Device Not Ready: 0 No
Device: 0 Recoverable: 0
Illegal Request: 0 Predictive Failure
Analysis: 0
sd16   
Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Vendor: FUJITSUProduct: MAP3735NC      Revision: 3701 Serial No:
Size: 73.49GB
Media Error: 0 Device Not Ready: 0 No
Device: 0 Recoverable: 0
Illegal Request: 0 Predictive Failure
Analysis: 0

IO使用率:
bash-3.00# iostat -d
   
sd4         sd15          sd16          nfs1      
kps tps servkps tps serv
kps tps servkps tps serv

0   0    0
13   3   15   
0   0    7   
0   0    0
HP-UX
硬盘大小、参数:
*** 获取主机硬盘个数:$ioscan -funC disk
结果:
Class   IH/W Path      Driver   S/W State   H/W Type   Description
===========================================================================
disk      00/0/0/3/0.5.0   sdisk    CLAIMED   DEVICE       HP 146 GST3146707LC
                            /dev/dsk/c0t5d0   /dev/rdsk/c0t5d0
disk      10/0/0/3/0.6.0   sdisk    CLAIMED   DEVICE       HP 146 GST3146707LC
                            /dev/dsk/c0t6d0   /dev/rdsk/c0t6d0
disk      20/0/4/1/0.0.0   sdisk    CLAIMED   DEVICE       COMPAQBD14688278
                            /dev/dsk/c2t0d0   /dev/rdsk/c2t0d0
disk      30/0/4/1/0.1.0   sdisk    CLAIMED   DEVICE       COMPAQBD14688278
                            /dev/dsk/c2t1d0   /dev/rdsk/c2t1d0
disk      40/0/8/1/0/1/0.4.0       sdisk    CLAIMED   DEVICE       _NEC    DVD+RW ND-2100AD
                            /dev/dsk/c3t4d0   /dev/rdsk/c3t4d0
disk      50/0/10/1/0.1.4.0.0.0.0sdisk    CLAIMED   DEVICE       COMPAQMSA1000 VOLUME
                            /dev/dsk/c7t0d0   /dev/rdsk/c7t0d0
disk      60/0/10/1/0.1.4.0.0.0.1sdisk    CLAIMED   DEVICE       COMPAQMSA1000 VOLUME
                            /dev/dsk/c7t0d1   /dev/rdsk/c7t0d1
disk      70/0/10/1/0.1.4.0.0.0.2sdisk    CLAIMED   DEVICE       COMPAQMSA1000 VOLUME
                            /dev/dsk/c7t0d2   /dev/rdsk/c7t0d2
disk      80/0/12/1/0.1.4.0.0.0.0sdisk    CLAIMED   DEVICE       COMPAQMSA1000 VOLUME
                            /dev/dsk/c8t0d0   /dev/rdsk/c8t0d0
disk      90/0/12/1/0.1.4.0.0.0.1sdisk    CLAIMED   DEVICE       COMPAQMSA1000 VOLUME
                            /dev/dsk/c8t0d1   /dev/rdsk/c8t0d1
disk   100/0/12/1/0.1.4.0.0.0.2sdisk    CLAIMED   DEVICE       COMPAQMSA1000 VOLUME
                            /dev/dsk/c8t0d2   /dev/rdsk/c8t0d2
*** 获取硬盘大小:$diskinfo /dev/dsk/c0t5d0
结果:
SCSI describe of c0t5d0 :
             vendor: HP
         product id: GST3146707LC
                  type: direct access
                   size: 8891556 Kbytes
bytes per sector: 512
$ pvdisplay /dev/dsk/c7t0d1
--- Physical volumes ---
PV Name                     /dev/dsk/c7t0d1
PV Name                     /dev/dsk/c8t0d1   Alternate Link
VG Name                     /dev/vgora
PV Status                   available               
Allocatable               yes         
VGDA                        2   
Cur LV                      2      
PE Size (Mbytes)            32            
Total PE                  12798   
Free PE                     298   
Allocated PE                12500      
Stale PE                  0      
IO Timeout (Seconds)      default            
Autoswitch                  On   

               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/18757/showart_373338.html
页: [1]
查看完整版本: 硬盘相关命令