Solution to linux ext4 failure to use a disk larger than 16 TB
System Environment: Centos6.7 x86_64 updte Disk: 12*4 T raid5 + hot Description: the operating system and archive use the same RAID 5 application environment: post Office System [file size ranges from 1 K to K, except attachment] 1. View partition [fdisk-l]
[root@localhost sysadmin]# fdisk -lWARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.Disk /dev/sda: 40000.0 GB, 39999997214720 bytes255 heads, 63 sectors/track, 4863055 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000 Device Boot Start End Blocks Id System/dev/sda1 1 267350 2147483647+ ee GPT
Note: At this time, the file system has exceeded 16 TB, and OS converts it to GPT format by default. Therefore, you cannot view accurate partition information using fdisk. Ii. Use parted to view partition information
[root@localhost sysadmin]# partedGNU Parted 2.1Using /dev/sdaWelcome to GNU Parted! Type 'help' to view a list of commands.(parted) p Model: LSI AOC-USAS2LP-H8iR (scsi)Disk /dev/sda: 40.0TBSector size (logical/physical): 512B/512BPartition Table: gptNumber Start End Size File system Name Flags1 1049kB 525MB 524MB ext42 525MB 263GB 262GB ext43 263GB 284GB 21.0GB ext44 284GB 288GB 4295MB linux-swap(v1)
3. Divide the remaining space into/archive as the root directory of the archive
(parted) mkpart /archive 288G -1(parted) p Model: LSI AOC-USAS2LP-H8iR (scsi)Disk /dev/sda: 40.0TBSector size (logical/physical): 512B/512BPartition Table: gptNumber Start End Size File system Name Flags1 1049kB 525MB 524MB ext42 525MB 263GB 262GB ext43 263GB 284GB 21.0GB ext44 284GB 288GB 4295MB linux-swap(v1)5 288GB 40.0TB 39.7TB /archive(parted)q
4. view the partition [root @ localhost ~] # Fdisk/dev/sdasda sda1 sda2 sda3 sda4 sda5 [root @ localhost ~] # Note: A New partition [sda5] has been found. 5. Modify/etc/mke2fd. conf.
# Vim/etc/mke2fs. conf [fs_types] ext3 = {features = has_journal} ext4 = {features = has_journal, extent, huge_file, flex_bg, inline, dir_nlink, inline auto_64-bit_support = 1 # Add this line of inode_size = 256}
Download e2fsprogs-1.42.13.tar.gz
[root@localhost ~]# wget -c http://jaist.dl.sourceforge.net/project/e2fsprogs/e2fsprogs/v1.42.8/e2fsprogs-1.42.13.tar.gz[root@localhost e2fsprogs-1.42.13]# pwd/home/sysadmin/e2fsprogs-1.42.13[root@localhost e2fsprogs-1.42.13]# cd build/[root@localhost build]# ../configure....[root@localhost build]# make && make install
7. Format partitions
[root@localhost ~]# mke2fs -O 64bit,has_journal,extents,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize -i 2048 /dev/sda5[root@localhost build]# blkid/dev/sda1: UUID="908a3c8e-6d6a-4e01-8cad-2094ea99751f" TYPE="ext4"/dev/sda3: UUID="b533714f-4cb9-4394-907d-8d1ead424c85" TYPE="ext4"/dev/sda2: UUID="0a0ec20e-b50b-4d89-9fa6-65602e4e8a3d" TYPE="ext4"/dev/sda4: TYPE="swap" UUID="b8e89719-670f-4b26-bbf3-86d13a1f935e"/dev/sda5: UUID="3b5789ee-94c2-4296-bd99-5669200d826a" TYPE="ext4"
Note: mke2fs format description:-B <block size>: Specifies the block size, in bytes;-c; check for damaged blocks;-f <size of discontinuous blocks>: specify the size of the inconsecutive segment, in bytes;-F: enforces mke2fs regardless of the specified device;-I <byte>: Specifies the ratio of "Byte/inode; -N: specifies the number of inode to be created.-l <File>: reads information about damaged blocks in the west of the file from the specified file.-L <tag>: set the tag name of the file system.-m <percentage value>: Specifies the ratio of the blocks to be reserved by the Administrator. The default value is 5%.-M: records the last mounted directory.-q: -r: Specifies the version of the ext2 file system to be created;-R = <number of blocks>: sets disk array parameters;-S: write only superblock and group descriptors without changing inode able inode bitmap and block bitmap;-v: displays details during execution;-V: displays version information. . 8. Mount the corresponding partition.
[root@localhost build]# df -hFilesystem Size Used Avail Use% Mounted on/dev/sda3 20G 2.4G 16G 14% /tmpfs 7.8G 0 7.8G 0% /dev/shm/dev/sda1 477M 80M 372M 18% /boot/dev/sda2 241G 120M 228G 1% /home/dev/sda5 36T 20K 34T 1% /archive[root@localhost build]# df -iFilesystem Inodes IUsed IFree IUse% Mounted on/dev/sda3 1281120 91214 1189906 8% /tmpfs 2040386 1 2040385 1% /dev/shm/dev/sda1 128016 46 127970 1% /boot/dev/sda2 16007168 1955 16005213 1% /home/dev/sda5 4293781536 11 4293781525 1% /archive
9. view disk Information
[root@localhost build]# tune2fs -l /dev/sda5tune2fs 1.42.13 (17-May-2015)Filesystem volume name: <none>Last mounted on: <not available>Filesystem UUID: 3b5789ee-94c2-4296-bd99-5669200d826aFilesystem magic number: 0xEF53Filesystem revision #: 1 (dynamic)Filesystem features: has_journal ext_attr dir_index filetype needs_recovery extent 64bit flex_bg sparse_super huge_file uninit_bg dir_nlink extra_isizeFilesystem flags: signed_directory_hashDefault mount options: user_xattr aclFilesystem state: cleanErrors behavior: ContinueFilesystem OS type: LinuxInode count: 4293781536Block count: 9695327232Reserved block count: 484766361Free blocks: 9426221107Free inodes: 4293781525First block: 0Block size: 4096Fragment size: 4096Group descriptor size: 64Blocks per group: 32768Fragments per group: 32768Inodes per group: 14512Inode blocks per group: 907Flex block group size: 16Filesystem created: Thu Oct 15 15:27:56 2015Last mount time: Thu Oct 15 15:33:50 2015Last write time: Thu Oct 15 15:33:50 2015Mount count: 1Maximum mount count: 33Last checked: Thu Oct 15 15:27:56 2015Check interval: 15552000 (6 months)Next check after: Tue Apr 12 15:27:56 2016Lifetime writes: 202 MBReserved blocks uid: 0 (user root)Reserved blocks gid: 0 (group root)First inode: 11Inode size: 256Required extra isize: 28Desired extra isize: 28Journal inode: 8Default directory hash: half_md4Directory Hash Seed: 56a5949a-5a49-4bc9-810d-9a9e2aa2109bJournal backup: inode blocks