ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 格式化分区及测试命令

格式化分区及测试命令

原创 Linux操作系统 作者:xiayusweetdream 时间:2012-03-09 16:13:57 0 删除 编辑

一、格式化分区

mkfs.xfs -f -i size=512 -l size=128m,lazy-count=1 -d agcount=16 /dev/sda5

参数解释:

-f:

Force overwrite when an existing filesystem is detected  on  the device.  By default, mkfs.xfs will not write to the device if it suspects that there is a filesystem or partition  table  on  the device already.
 
-i:
inode_options
This  option  specifies  the  inode  size of the filesystem, and other inode allocation parameters.  The  XFS  inode  contains  a fixed-size  part  and  a  variable-size part.  The variable-size part, whose size  is  affected  by  this  option,  can  contain:directory data, for small directories; attribute data, for small attribute sets; symbolic link data, for  small  symbolic  links;the  extent  list for the file, for files with a small number of extents; and the root of  a  tree  describing  the  location  of extents  for the file, for files with a large number of extents.

The valid inode_options are:

size=value | log=value | perblock=value
The inode size is specified either  as  a  value  in bytes  with  size=,  a base two logarithm value with log=, or as the number fitting in a filesystem block with  perblock=.  The mininum (and default) value is 256 bytes.   The  maximum  value  is  2048  (2  KiB)subject  to  the  restriction  that  the  inode size cannot exceed one half of the filesystem block size.XFS  uses  64-bit inode numbers internally; however,the number of significant bits in an inode number is
affected   by  filesystem  geometry.In  practice,filesystem size and inode size are  the  predominant factors.   The  Linux  kernel  (on  32  bit hardware platforms) and most  applications  cannot  currently handle  inode  numbers  greater  than 32 significant bits, so if no inode size is given  on  the  command line,  mkfs.xfs  will  attempt to choose a size such that inode numbers will be < 32 bits.  If  an  inode size is specified, or if a filesystem is sufficently
large, mkfs.xfs will warn if this will create  inode numbers > 32 significant bits.
 
-l:
log_section_options
 
These options specify the location, size, and  other  parameters of the log section of the filesystem.
size=value
This is used to specify the size of the log section.If the log is contained within the data section  and size  isn’t specified, mkfs.xfs will try to select a suitable log size  depending  on  the  size  of  the filesystem.   The  actual  logsize  depends  on  the filesystem block size and the directory block  size.Otherwise,  the size suboption is only needed if the log section of the  filesystem  should  occupy  less space  than  the size of the special file. The value
is specified in bytes or blocks,  with  a  b  suffix meaning multiplication by the filesystem block size,as described above. The overriding minimum value for size  is  512  blocks.   With  some  combinations of filesystem block size,  inode  size,  and  directory block  size, the minimum log size is larger than 512 blocks.
 
-l:
log_section_options
 
These options specify the location, size, and  other  parameters of  the log  section of the filesystem.
size=value
This is used to specify the size of the log section.
If the log is contained within the data section  and size  isn’t specified, mkfs.xfs will try to select a suitable log size  depending  on  the  size  of  the filesystem.   The  actual  logsize  depends  on  the filesystem block size and the directory block  size.Otherwise,  the size suboption is only needed if the log section of the  filesystem  should  occupy  less space  than  the size of the special file. The value is specified in bytes or blocks,  with  a  b  suffix
meaning multiplication by the filesystem block size,as described above. The overriding minimum value for size  is  512  blocks.   With  some  combinations of filesystem block size,  inode  size,  and  directory block  size, the minimum log size is larger than 512 blocks.
 
lazy-count=value
This changes the method of logging various persistent   counters in the superblock.Under metadata intensive  workloads,  these  counters  are updated   and  logged  frequently  enough  that  the superblock updates become a serialisation  point  in the filesystem. The value can be either 0 or 1.With lazy-count=1, the superblock is not modified or logged on every change of the  persistent  counters.Instead,  enough  information is kept in other parts
of the filesystem to be able to maintain the persistent counter values without needed to keep them in  the  superblock.This  gives  significant mprovements  in performance on some configurations.The default value is 0 (off)  so  you  must  specify azy-count=1  if  you  want  to  make  use  of  this feature.
 
-d:
data_section_options
 
These  options  specify the location, size, and other parameters of the data section of the filesystem.
agcount=value
This  is  used  to  specify the number of allocation groups  The  data  section  of  the  filesystem  is
divided   into  allocation  groups  to  improve  the
performance of XFS.  More  allocation  groups  imply that   more   parallelism   can   be  achieved  when allocating blocks and inodes. The minimum allocation group size is 16 MiB; the maximum size is just under 1 TiB.   The  data  section  of  the  filesystem  is divided  into value allocation groups (default value is scaled  automatically  based  on  the  underlying device size).
以上资料来源:http://manpages.ubuntu.com/manpages/jaunty/en/man8/mkfs.xfs.8.html
 
二、测试磁盘读写能力
 
time dd if=/dev/zero f=/data/foo bs=4k count=1024000  ; time dd if=/data/foo f=/dev/null bs=4k ; time dd if=/data/foo f=/data/foo2 bs=4k
几点说明:
1.time
执行命令并计时
2.dd
if:输入文件名,缺省为标准输入
of:输出文件名,缺省为标准输出
bs:同时设置读写块的大小,可替代ibs(一次读入bytes个字节)和obs(一次写bytes个字节)
count:拷贝blocks个块,块大小为ibs指定的字节数
3.读写能力测试
通过使用dd if=/dev/zero f=/file 来测试磁盘的纯写入性能
通过使用dd if=/file f=/dev/null 来测试磁盘的纯读取性能
通过使用dd if=/file1 f=/file2 来测试磁盘的读写性能



 
 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/23073137/viewspace-718179/,如需转载,请注明出处,否则将追究法律责任。

上一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2012-03-09

  • 博文量
    15
  • 访问量
    46617