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
==============================================================================
根據(jù)”維基百科“和“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
意思就是說(shuō),ext4支持最大1EiB(1EiB=1024PiB ,1PiB=1024TiB ,1TiB=1024GiB)的文件系統(tǒng)和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
今天在格式化一個(gè)20T的Raid空間時(shí)候,發(fā)生了這個(gè)錯(cuò)誤:
mkfs.ext4: Size of device /dev/md0 too big to be expressed in 32 bits
using a blocksize of 4096.
有人說(shuō):
雖然 ext4 的 feature list 有支援 > 16TB, 不過(guò).... 那目前來(lái)看就只是設(shè)計(jì)目標(biāo), 因?yàn)?nbsp;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了。
而實(shí)際上,這個(gè)問(wèn)題早有人解決了,解決方法起始也比較簡(jiǎn)單。
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
原來(lái)EXT4是真的支持1EiB的文件系統(tǒng)的,只是mkfs無(wú)法支持大于16T的文件系統(tǒng),所以只需要升級(jí)一下格式化工具即可。
關(guān)于為什么mkfs.ext4不能格式化大于16T的Ext4文件系統(tǒng)以及其解決方法,原文解釋如下:
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.
所以,只需要升級(jí)下工具即可,升級(jí)方式如下:
git clone git://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
cd e2fsprogs
./configure
make && make install
完畢之后還是不能用mkfs.ext4來(lái)格式化,而要用“mke2fs”進(jìn)行格式化,命令參考如下:
mke2fs -O 64bit,has_journal,extents,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize -i 4194304 /dev/md0
需要注意的是,這是一個(gè)還在開(kāi)發(fā)中的工具,使用請(qǐng)個(gè)人承擔(dān)風(fēng)險(xiǎn):
This are *development* tools – use at your OWN RISK
格式化完畢后就掛載了,來(lái)看看你的超大EXT4文件系統(tǒng)吧:
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文作者總結(jié)了這么幾點(diǎn),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系統(tǒng)使用的ext2或ext3
必要參數(shù)
<設(shè)備名稱> 與設(shè)備對(duì)應(yīng)文件,例如/dev/hd1
-b<塊大小> 指定塊大小
-c 在創(chuàng)建文件系統(tǒng)之前檢查指定的設(shè)備
-g<塊組數(shù)量> 指定一個(gè)塊組中塊的數(shù)量
選擇參數(shù)
-E<擴(kuò)展參數(shù)> 為要?jiǎng)?chuàng)建的文件系統(tǒng)指定一些參數(shù)
-f<不連續(xù)區(qū)段大小> 不知道連續(xù)區(qū)段的大小
-F 強(qiáng)制執(zhí)行,即使指定設(shè)備沒(méi)有被掛載或者不是塊設(shè)備
-l<文件> 從指定文件中讀取壞的塊列表
-i<字節(jié)> 指定每個(gè)inode的字節(jié)數(shù)
-j 創(chuàng)建使用ext3卷號(hào)的文件系統(tǒng)
-J<擴(kuò)展參數(shù)> 為使用ext3卷號(hào)的文件系統(tǒng)指定一些參數(shù)
-L 設(shè)置創(chuàng)建的文件系統(tǒng)的標(biāo)簽
-N 指定iniode的數(shù)量
-q 執(zhí)行時(shí)不顯示任何信息
-E<擴(kuò)展選項(xiàng)> 為要?jiǎng)?chuàng)建的文件系統(tǒng)指定一些可選項(xiàng)
-f<不連續(xù)區(qū)段大小> 指定不連接區(qū)段的大小
-F 強(qiáng)制執(zhí)行,即使指定設(shè)備沒(méi)有被掛載或者不是塊設(shè)備
-l<文件> 從指定的文件中讀取壞的塊列表
-i<字節(jié)> 指定每個(gè)inode的字節(jié)數(shù)
-j 創(chuàng)建使用ext3卷號(hào)的文件系統(tǒng)
-J<擴(kuò)展選項(xiàng)> 為使用ext3卷號(hào)文件系統(tǒng)指定一些選項(xiàng)
-L 設(shè)置創(chuàng)建的文件系統(tǒng)的標(biāo)簽
-N 指定inode的數(shù)量
-q 執(zhí)行時(shí)不顯示任何信息
-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
二。新建分區(qū)及文件
[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.shnenglu.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
posted on 2016-06-22 11:53
聶文龍 閱讀(5873)
評(píng)論(0) 編輯 收藏 引用 所屬分類:
Linux