Limit maximum ext2/3/4 volume size to just less than 16 TiB (#766910)
Maximum size of an ext2/3/4 volume is 2^32 - 1 blocks [1], ignoring ext4 with 64bit feature. That is just under 16 TiB with a 4K block size. # truncate -s 16T /mnt/1/sparse.img # ls -l /mnt/1/sparse.img -rw-r--r--. 1 root root 17592186044416 May 28 19:33 /mnt/1/sparse.img # losetup /dev/loop0 /mnt/1/sparse.img # mkfs.ext3 /dev/loop0 mke2fs 1.43 (17-May-2016) mkfs.ext3: Size of device (0x100000000 blocks) /dev/loop0 too big to be expressed in 32 bits using a blocksize of 4096. # losetup -d /dev/loop0 # # # truncate -s $((16*1024**3-4))K sparse.img # ls -l /mnt/1/sparse.img -rw-r--r--. 1 root root 17592186040320 May 28 19:51 /mnt/1/sparse.img # losetup /dev/loop0 /mnt/1/sparse.img # mkfs.ext3 /dev/loop0 mke2fs 1.43 (17-May-2016) Discarding device blocks: done Creating filesystem with 4294967295 4k blocks and 536870912 inodes Filesystem UUID: 9721d8d9-8711-499b-aae4-8ea4d9e16ca2 Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 102400000, 214990848, 512000000, 550731776, 644972544, 1934917632, 2560000000, 3855122432 Allocating group tables: done Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done # losetup -d /dev/loop0 # rm /mnt/1/sparse.img Actually limit the maximum volume size to 1 MiB less than 16 TiB for coding reasons explained in the FIXME comment. [1] Ext4 Disk Layout, Blocks https://ext4.wiki.kernel.org/index.php/Ext4_Disk_Layout#Blocks Bug 766910 - Multiple boot loaders don't work on 64bit EXT4 file systems
This commit is contained in:
parent
58d409787b
commit
af17808d08
10
src/ext2.cc
10
src/ext2.cc
|
@ -114,6 +114,16 @@ FS ext2::get_filesystem_support()
|
|||
if ( specific_type != FS_EXT2 && Utils::kernel_version_at_least( 3, 6, 0 ) )
|
||||
fs .online_grow = fs .grow ;
|
||||
#endif
|
||||
|
||||
// Maximum size of an ext2/3/4 volume is 2^32 - 1 blocks, ignoring ext4
|
||||
// with 64bit feature. That is just under 16 TiB with a 4K block size.
|
||||
// * Ext4 Disk Layout, Blocks
|
||||
// https://ext4.wiki.kernel.org/index.php/Ext4_Disk_Layout#Blocks
|
||||
// FIXME: Rounding down to whole MiB here should not be necessary. The
|
||||
// Copy, New and Resize/Move dialogs should limit FS correctly without
|
||||
// this. See bug #766910 comment #12 onwards for further discussion.
|
||||
// https://bugzilla.gnome.org/show_bug.cgi?id=766910#c12
|
||||
fs.MAX = Utils::floor_size( 16 * TEBIBYTE - 4 * KIBIBYTE, MEBIBYTE );
|
||||
}
|
||||
|
||||
return fs ;
|
||||
|
|
Loading…
Reference in New Issue