mke2fs -O 64bit,has_journal,extents,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize -i 4194304 /dev/iscsi/test
mke2fs -O 64bit,has_journal,extents,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize -i 4194304 /dev/md0
==============================================================================
根据”维基百科“和“kernel.org”:
Ext4 adds 48-bit block addressing, so it will have 1EiB of maximum file system size and 16 TiB of maximum file size
意思就是说,ext4支持最大1EiB(1EiB=1024PiB ,1PiB=1024TiB ,1TiB=1024GiB)的文件系统和16TiB的文件。
http://en.wikipedia.org/wiki/File_system_comparison#Limits
https://ext4.wiki.kernel.org/index.php/Ext4_Howto#Bigger_File_System_and_File_Sizes
今天在格式化一个20T的Raid空间时候,发生了这个错误:
mkfs.ext4: Size of device /dev/md0 too big to be expressed in 32 bits
using a blocksize of 4096.
有人说:
雖然 ext4 的 feature list 有支援 > 16TB, 不過.... 那目前來看就只是設計目標, 因為 e2fsprogs 不支援 > 16TB.....
https://ext4.wiki.kernel.org/index.php/Ext4_Howto#Creating_ext4_filesystems
NOTE: Although very large fileystems are on ext4's feature list, current e2fsprogs currently still limits the filesystem size to 2^32 blocks (16TiB for a 4KiB block filesystem). Allowing filesystems larger than 16T is one of the very next high-priority features to complete for ext4.
很多人用mkfs.ext4尝试不通之后,就改用xfs了。
而实际上,这个问题早有人解决了,解决方法起始也比较简单。
http://blog.ronnyegner-consulting.de/2011/08/18/ext4-and-the-16-tb-limit-now-solved/
http://rritw.com/a/JAVAbiancheng/ANT/20101003/43604.html
原来EXT4是真的支持1EiB的文件系统的,只是mkfs无法支持大于16T的文件系统,所以只需要升级一下格式化工具即可。
关于为什么mkfs.ext4不能格式化大于16T的Ext4文件系统以及其解决方法,原文解释如下:
To be specific: Even with the most recent e2fsprogs 1.41.14 there is no way to create file systems larger than 16 TB.
But: According to this post it should work since June:
It’s taken way too long, but I’ve finally finished integrating the 64-bit patches into e2fsprogs’s mainline repository. All of the necessary patches should now be in the master branch for e2fsprogs. The big change from before is that I replaced Val’s changes for fixing up how mke2fs picked the correct fs-type profile from mke2fs.conf with something that I think works much better and leaves the code much cleaner. With this change you need to add the following to your /etc/mke2fs.conf file if you want to enable the 64-bit feature flag automatically for a big disk:
[fs_types] ext4 = {
features = has_journal,extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize
auto_64-bit_support = 1 # <—- add this line
inode_size = 256
}
Alternatively you can change the features line to include the feature “64bit”; this will force the use of the 64-bit fields, and double the size of the block group descriptors, even for smaller file systems that don’t require the 64-bit support. (This was one of my problems with Val’s implementation; it forced the mke2fs.conf file to always enable the 64-bit feature flag, which would cause backwards compatibility issues.) This might be a good thing to do for debugging purposes, though, so this is an option which I left open, but the better way of doing things is to use the auto_64-bit-support flag.
所以,只需要升级下工具即可,升级方式如下:
git clone git://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
cd e2fsprogs
./configure
make && make install
完毕之后还是不能用mkfs.ext4来格式化,而要用“mke2fs”进行格式化,命令参考如下:
mke2fs -O 64bit,has_journal,extents,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize -i 4194304 /dev/md0
需要注意的是,这是一个还在开发中的工具,使用请个人承担风险:
This are *development* tools – use at your OWN RISK
格式化完毕后就挂载了,来看看你的超大EXT4文件系统吧:
mount -t ext4 /dev/md0 /mnt
mount|grep md0
/dev/md0 on /cache/data type ext4 (rw)
df -h
/dev/md0 19T 229M 18T 1% /mnt
最后,E文作者总结了这么几点,Conclusion:
With the most recent e2fstools (1.42-WIP) it is possible to create ext4 file system larger than 16 TB.
If you do so remember the following:
-
the tool is still in development – use at your own risk!
-
tune the values for autocheck (after x mounts / after y days)
-
adjust the “-i” switch which defines the bytes/inode ratio; in the example above one inode is created for every 8 MB
-
the more inodes you create the longer fsck takes and the more memory it needs
-
Resizing the file system (growing / shrinking) is NOT possible at the moment
==============================================================================
mke2fs 建立Linux系统使用的ext2或ext3
必要参数
<设备名称> 与设备对应文件,例如/dev/hd1
-b<块大小> 指定块大小
-c 在创建文件系统之前检查指定的设备
-g<块组数量> 指定一个块组中块的数量
选择参数
-E<扩展参数> 为要创建的文件系统指定一些参数
-f<不连续区段大小> 不知道连续区段的大小
-F 强制执行,即使指定设备没有被挂载或者不是块设备
-l<文件> 从指定文件中读取坏的块列表
-i<字节> 指定每个inode的字节数
-j 创建使用ext3卷号的文件系统
-J<扩展参数> 为使用ext3卷号的文件系统指定一些参数
-L 设置创建的文件系统的标签
-N 指定iniode的数量
-q 执行时不显示任何信息
-E<扩展选项> 为要创建的文件系统指定一些可选项
-f<不连续区段大小> 指定不连接区段的大小
-F 强制执行,即使指定设备没有被挂载或者不是块设备
-l<文件> 从指定的文件中读取坏的块列表
-i<字节> 指定每个inode的字节数
-j 创建使用ext3卷号的文件系统
-J<扩展选项> 为使用ext3卷号文件系统指定一些选项
-L 设置创建的文件系统的标签
-N 指定inode的数量
-q 执行时不显示任何信息
-V 显示版本信息
==============================================================================
[root@OEL63 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_oel63-lv_root
18G 11G 5.9G 65% /
tmpfs 496M 375M 121M 76% /dev/shm
/dev/sda1 485M 55M 405M 12% /boot
[root@OEL63 ~]# fdisk -l
Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 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: 0x000cd5a1
Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 1959 15215616 8e Linux LVM
/dev/sda3 1959 2610 5236185 8e Linux LVM
Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 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: 0x3d49ddef
Device Boot Start End Blocks Id System
/dev/sdb1 1 130 1044193+ 83 Linux
Disk /dev/sdc: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 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: 0x00000000
Disk /dev/mapper/vg_oel63-lv_root: 18.9 GB, 18857590784 bytes
255 heads, 63 sectors/track, 2292 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: 0x00000000
Disk /dev/mapper/vg_oel63-lv_swap: 2080 MB, 2080374784 bytes
255 heads, 63 sectors/track, 252 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: 0x00000000
二。新建分区及文件
[root@OEL63 ~]# fdisk /dev/sdc
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xcb0d4a1a.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1305, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1305, default 1305):
Using default value 1305
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@OEL63 ~]# mkfs -t ext4 /dev/sdc1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
655360 inodes, 2620595 blocks
131029 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2684354560
80 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 27 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
三。挂载到具体目录
[root@OEL63 ~]# mkdir /data01
[root@OEL63 ~]# mount /dev/sdc1 /data01
[root@OEL63 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_oel63-lv_root
18G 11G 5.9G 65% /
tmpfs 496M 375M 121M 76% /dev/shm
/dev/sda1 485M 55M 405M 12% /boot
/dev/sdc1 9.9G 151M 9.2G 2% /data01
[root@OEL63 ~]# vi /etc/fstab
#
# /etc/fstab
# Created by anaconda on Tue Aug 20 00:50:32 2013
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/vg_oel63-lv_root / ext4 defaults 1 1
UUID=c7219271-21be-4f0c-bc21-0dce3d881129 /boot ext4 defaults 1 2
/dev/mapper/vg_oel63-lv_swap swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/sdc1 /data01 ext4 defaults 1 1
@import url(http://www.cppblog.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
posted on 2016-06-22 11:53
聂文龙 阅读(5809)
评论(0) 编辑 收藏 引用 所属分类:
Linux