842  
   2
linux下如何快速格式化大容量硬盘
作者:张永强于 2018年02月08日 发布在分类 / 经验案例 / FAQ 下,并于 2018年02月08日 编辑
linux系统 快速格式化 大容量磁盘

一、提问

当使用fdisk/parted创建分区后,使用mkfs.ext4格式化文件系统时,那个速度之慢,几个T大小磁盘几个小时才完成格式化。在这期间就想有没有类似windows的快速格式化选项。

二、解决方法

man mkfs.ext4一路找可以看到这样的信息: 


1
2
3
4
5
6
7
8
9
10
11
12
13
14
- T usage - type [ , . . . ]
               Specify   how   the filesystem is going to be used , so that mke2fs
               can choose optimal filesystem   parameters   for    that   use .    The
               usage   types that are supported are defined in the configuration
               file / etc / mke2fs . conf ( 5 ) .    The user   may   specify   one   or    more
               usage types using a comma separated list .
 
               If    this    option   is is not specified , mke2fs will pick a single
               default usage type based on the size of   the   filesystem   to    be
               created .    If    the   filesystem   size   is less than or equal to 3
               megabytes , mke2fs will use the filesystem type floppy .    If    the
               filesystem   size is greater than 3 but less than or equal to 512
               megabytes , mke2fs ( 8 ) will use the filesystem small .    Otherwise ,
               mke2fs ( 8 ) will use the default filesystem type default .

然后查看/etc/mke2fs.conf


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
[ defaults ]
base_features = sparse_super , filetype , resize_inode , dir_index , ext_attr
blocksize = 4096
inode_size = 256
inode_ratio = 16384
 
[ fs_types ]
ext3 = {
features = has _journal
}
ext4 = {
features = has_journal , extent , huge_file , flex_bg , uninit_bg , dir_nlink , extra_isize
inode_size = 256
}
ext4dev = {
features = has_journal , extent , huge_file , flex_bg , uninit_bg , dir_nlink , extra_isize
inode_size = 256
options = test_fs = 1
}
small = {
blocksize = 1024
inode_size = 128
inode_ratio = 4096
}
floppy = {
blocksize = 1024
inode_size = 128
inode_ratio = 8192
}
news = {
inode_ratio = 4096
}
largefile = {
inode_ratio = 1048576
blocksize = - 1
}
largefile4 = {
inode_ratio = 4194304
blocksize = - 1
}
hurd = {
     blocksize = 4096
     inode_size = 128
}


测试mkfs.ext4  -T largefile /dev/xxx这个方式,几乎在几分钟完成快速格式化。


 知识评论当前评论数2

 推荐知识


 访问权限

创建人 张永强
工作小组 宏杉成员
文档编辑权限 创建者私有
文档阅读权限 来自分类
分类阅读权限 所有人
分类编辑权限 技术服务部  : 机构     渠道合作伙伴  : 机构     系统管理员 : 人员     
分类审核权限 审核小组  : 岗位    
分类预览权限 审核小组 : 岗位    
分类下载权限 技术服务部  : 机构    
 历史版本

修改日期 修改人 备注
2018-02-08 12:42:15[当前版本] 张永强 CREAT

 目录
    宏杉案例知识库-V4.0.1