Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1185092
  • 博文数量: 128
  • 博客积分: 10010
  • 博客等级: 上将
  • 技术积分: 4870
  • 用 户 组: 普通用户
  • 注册时间: 2007-04-19 14:28
文章分类

全部博文(128)

文章存档

2010年(2)

2009年(22)

2008年(104)

我的朋友

分类: LINUX

2009-03-06 11:02:05

rhel5中跟磁盘有关的几个小命令
1.blkid
  用来查看系统中设备的labels和文件系统类型,如下所示:
[root@rhel5 conf]# blkid
/dev/hda5: LABEL="SWAP-hda5" TYPE="swap"
/dev/hda3: LABEL="/1" UUID="43307fc2-3433-4ad2-98a1-22375c2cf9e6" TYPE="ext3"
/dev/hda1: LABEL="/boot1" UUID="bbed6563-0946-47cd-9ca2-ac65f41aebfd" TYPE="ext3"
/dev/hda2: LABEL="/home" UUID="7742e7db-b435-481f-9a37-3e81db276baa" TYPE="ext3"
2.sfdisk,linux中分区表的操纵者。
查看磁盘的大小:
[root@rhel5 ~]# sfdisk -s
/dev/hda:  58605120
total: 58605120 blocks
查看某个分区的大小:
[root@rhel5 ~]# sfdisk -s /dev/hda2
2096482
列出分区表:
[root@rhel5 ~]# sfdisk -l /dev/hda
Disk /dev/hda: 116280 cylinders, 16 heads, 63 sectors/track
Warning: extended partition does not start at a cylinder boundary.
DOS and Linux will interpret the contents differently.
Warning: The partition table looks like it was made
  for C/H/S=*/255/63 (instead of 116280/16/63).
For this listing I'll assume that geometry.
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0
   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/hda1   *      0+     12      13-    104391   83  Linux
/dev/hda2         13     273     261    2096482+  83  Linux
/dev/hda3        274    2883    2610   20964825   83  Linux
/dev/hda4       2884    7295    4412   35439390    5  Extended
/dev/hda5       2884+   3013     130-   1044193+  82  Linux swap / Solaris
3.tune2fs和dumpe2fs
tune2fs是linux下面重要的文件系统调整工具,其中的几个选项解释如下:
-c:表示文件系统在mount次数达到设定后,需要运行fsck检查文件系统。
-i:文件系统的检查间隔时间。系统在达到时间间隔时,自动检查文件系统。
-l:显示文件系统的很多参数。
-j:转换为ext3文件系统。
-m:Set the percentage of reserved filesystem blocks。 设置保留的空间百分比
-o:Set or clear the indicated default mount options in the filesystem.设置默认加载参数.
通常如果使用ext3文件系统的话,使用-c 0关掉mount次数达到后的文件系统检查。
修改文件系统保留的块的百分比,默认为5%.
[root@rhel5 ~]# tune2fs -l /dev/hda1
tune2fs 1.39 (29-May-2006)
Filesystem volume name:   /boot1
Last mounted on:         
Filesystem UUID:          bbed6563-0946-47cd-9ca2-ac65f41aebfd
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery sparse_super
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              26104
Block count:              104388
Reserved block count:     5219
Free blocks:              89854
Free inodes:              26071
First block:              1
Block size:               1024
Fragment size:            1024
Reserved GDT blocks:      256
Blocks per group:         8192
Fragments per group:      8192
Inodes per group:         2008
Inode blocks per group:   251
Filesystem created:       Thu Mar  5 20:07:00 2009
Last mount time:          Fri Mar  6 10:06:14 2009
Last write time:          Fri Mar  6 10:06:14 2009
Mount count:              4
Maximum mount count:      -1
Last checked:             Thu Mar  5 20:07:00 2009
Check interval:           0 ()
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               128
Journal inode:            8
Default directory hash:   tea
Directory Hash Seed:      49de1ba9-8beb-4bc5-93b6-89036dcfcca7
Journal backup:           inode blocks
[root@rhel5 ~]# tune2fs -m 10 /dev/hda1|grep 'Reserved block count:'
Reserved block count:     10438
设置默认的挂载选项:
[root@rhel5 ~]# tune2fs -o acl,user_xattr /dev/hda1
tune2fs 1.39 (29-May-2006)
[root@rhel5 ~]# tune2fs -l /dev/hda1|grep 'Default mount options:'
Default mount options:    user_xattr acl
禁止强制的文件系统检查:
[root@rhel5 ~]# tune2fs -i0 -c0 /dev/hda1
tune2fs 1.39 (29-May-2006)
Setting maximal mount count to -1
Setting interval between checks to 0 seconds
[root@rhel5 ~]# tune2fs -l /dev/hda1
tune2fs 1.39 (29-May-2006)
Filesystem volume name:   /boot1
Last mounted on:         
Filesystem UUID:          bbed6563-0946-47cd-9ca2-ac65f41aebfd
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery sparse_super
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              26104
Block count:              104388
Reserved block count:     10438
Free blocks:              89854
Free inodes:              26071
First block:              1
Block size:               1024
Fragment size:            1024
Reserved GDT blocks:      256
Blocks per group:         8192
Fragments per group:      8192
Inodes per group:         2008
Inode blocks per group:   251
Filesystem created:       Thu Mar  5 20:07:00 2009
Last mount time:          Fri Mar  6 10:06:14 2009
Last write time:          Fri Mar  6 10:55:46 2009
Mount count:              4
Maximum mount count:      -1
Last checked:             Thu Mar  5 20:07:00 2009
Check interval:           0 ()
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               128
Journal inode:            8
Default directory hash:   tea
Directory Hash Seed:      49de1ba9-8beb-4bc5-93b6-89036dcfcca7
Journal backup:           inode blocks
 
dump2fs显示当前的磁盘状态:
[root@rhel5 ~]# dumpe2fs /dev/hda1
dumpe2fs 1.39 (29-May-2006)
Filesystem volume name:   /boot1
Last mounted on:         
Filesystem UUID:          bbed6563-0946-47cd-9ca2-ac65f41aebfd
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery sparse_super
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              26104
Block count:              104388
Reserved block count:     5219
Free blocks:              89854
Free inodes:              26071
First block:              1
Block size:               1024
Fragment size:            1024
Reserved GDT blocks:      256
Blocks per group:         8192
Fragments per group:      8192
Inodes per group:         2008
Inode blocks per group:   251
Filesystem created:       Thu Mar  5 20:07:00 2009
Last mount time:          Fri Mar  6 10:06:14 2009
Last write time:          Fri Mar  6 10:57:22 2009
Mount count:              4
Maximum mount count:      -1
Last checked:             Thu Mar  5 20:07:00 2009
Check interval:           0 ()
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               128
Journal inode:            8
Default directory hash:   tea
Directory Hash Seed:      49de1ba9-8beb-4bc5-93b6-89036dcfcca7
Journal backup:           inode blocks
Journal size:             4114k

Group 0: (Blocks 1-8192)
  Primary superblock at 1, Group descriptors at 2-2
  Reserved GDT blocks at 3-258
  Block bitmap at 259 (+258), Inode bitmap at 260 (+259)
  Inode table at 261-511 (+260)
  511 free blocks, 1992 free inodes, 2 directories
  Free blocks: 5557-6067
  Free inodes: 17-2008
Group 1: (Blocks 8193-16384)
  Backup superblock at 8193, Group descriptors at 8194-8194
  Reserved GDT blocks at 8195-8450
  Block bitmap at 8451 (+258), Inode bitmap at 8452 (+259)
  Inode table at 8453-8703 (+260)
  5374 free blocks, 2008 free inodes, 0 directories
  Free blocks: 11011-16384
  Free inodes: 2009-4016
Group 2: (Blocks 16385-24576)
  Block bitmap at 16385 (+0), Inode bitmap at 16386 (+1)
  Inode table at 16387-16637 (+2)
  7939 free blocks, 2008 free inodes, 0 directories
  Free blocks: 16638-24576
  Free inodes: 4017-6024
Group 3: (Blocks 24577-32768)
  Backup superblock at 24577, Group descriptors at 24578-24578
  Reserved GDT blocks at 24579-24834
  Block bitmap at 24835 (+258), Inode bitmap at 24836 (+259)
  Inode table at 24837-25087 (+260)
  7681 free blocks, 2008 free inodes, 0 directories
  Free blocks: 25088-32768
  Free inodes: 6025-8032
Group 4: (Blocks 32769-40960)
  Block bitmap at 32769 (+0), Inode bitmap at 32770 (+1)
  Inode table at 32771-33021 (+2)
  7939 free blocks, 2008 free inodes, 0 directories
  Free blocks: 33022-40960
  Free inodes: 8033-10040
Group 5: (Blocks 40961-49152)
  Backup superblock at 40961, Group descriptors at 40962-40962
  Reserved GDT blocks at 40963-41218
  Block bitmap at 41219 (+258), Inode bitmap at 41220 (+259)
  Inode table at 41221-41471 (+260)
  7681 free blocks, 2008 free inodes, 0 directories
  Free blocks: 41472-49152
  Free inodes: 10041-12048
Group 6: (Blocks 49153-57344)
  Block bitmap at 49153 (+0), Inode bitmap at 49154 (+1)
  Inode table at 49155-49405 (+2)
  7939 free blocks, 2008 free inodes, 0 directories
  Free blocks: 49406-57344
  Free inodes: 12049-14056
Group 7: (Blocks 57345-65536)
  Backup superblock at 57345, Group descriptors at 57346-57346
  Reserved GDT blocks at 57347-57602
  Block bitmap at 57603 (+258), Inode bitmap at 57604 (+259)
  Inode table at 57605-57855 (+260)
  7681 free blocks, 2008 free inodes, 0 directories
  Free blocks: 57856-65536
  Free inodes: 14057-16064
Group 8: (Blocks 65537-73728)
  Block bitmap at 65537 (+0), Inode bitmap at 65538 (+1)
  Inode table at 65539-65789 (+2)
  7939 free blocks, 2008 free inodes, 0 directories
  Free blocks: 65790-73728
  Free inodes: 16065-18072
Group 9: (Blocks 73729-81920)
  Backup superblock at 73729, Group descriptors at 73730-73730
  Reserved GDT blocks at 73731-73986
  Block bitmap at 73987 (+258), Inode bitmap at 73988 (+259)
  Inode table at 73989-74239 (+260)
  7462 free blocks, 1991 free inodes, 1 directories
  Free blocks: 74240-75776, 75778-76288, 76393-76800, 76809-77312, 77321-77824, 77832-78336, 78380-78848, 78857-79360, 79368-79872, 79883-80384, 80392-80896, 80904-81408, 81418-81920
  Free inodes: 18090-20080
Group 10: (Blocks 81921-90112)
  Block bitmap at 81921 (+0), Inode bitmap at 81922 (+1)
  Inode table at 81923-82173 (+2)
  7939 free blocks, 2008 free inodes, 0 directories
  Free blocks: 82174-90112
  Free inodes: 20081-22088
Group 11: (Blocks 90113-98304)
  Block bitmap at 90113 (+0), Inode bitmap at 90114 (+1)
  Inode table at 90115-90365 (+2)
  7939 free blocks, 2008 free inodes, 0 directories
  Free blocks: 90366-98304
  Free inodes: 22089-24096
Group 12: (Blocks 98305-104387)
  Block bitmap at 98305 (+0), Inode bitmap at 98306 (+1)
  Inode table at 98307-98557 (+2)
  5830 free blocks, 2008 free inodes, 0 directories
  Free blocks: 98558-104387
  Free inodes: 24097-26104
阅读(1414) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~