> CentOS > CentOS故障 >

centos下ext4无法使用超过16T磁盘的解决办法

系统环境:Centos6.7 x86_64 己updte
磁盘:12*4T raid5 +hot
说明:操作系统与归档都使用raid5

一、查看分区 【fdisk -l】
[root@localhost sysadmin]# fdisk -l
WARNING: 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 bytes
255 heads, 63 sectors/track, 4863055 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
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1      267350  2147483647+  ee  GPT
 
说明:此时文件系统己经超过16T,OS默认将其转换成了GPT格式的,所以使用fdisk无法查看到准确的分区信息。
 
二、使用parted 查看分区信息
[root@localhost sysadmin]# parted
GNU Parted 2.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p                                                               
Model: LSI AOC-USAS2LP-H8iR (scsi)
Disk /dev/sda: 40.0TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number  Start   End     Size    File system     Name      Flags
1      1049kB  525MB   524MB   ext4
2      525MB   263GB   262GB   ext4
3      263GB   284GB   21.0GB  ext4
4      284GB   288GB   4295MB  linux-swap(v1)
 
将余下的空间都分为/archive 作为归档的根目录
(parted)  mkpart /archive 288G -1
(parted) p
(parted) p                                                               
Model: LSI AOC-USAS2LP-H8iR (scsi)
Disk /dev/sda: 40.0TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number  Start   End     Size    File system     Name      Flags
1      1049kB  525MB   524MB   ext4
2      525MB   263GB   262GB   ext4
3      263GB   284GB   21.0GB  ext4
4      284GB   288GB   4295MB  linux-swap(v1)
5      288GB   40.0TB  39.7TB                  /archive
(parted)q
 
三、查看分区
[root@localhost ~]# fdisk /dev/sda
sda   sda1  sda2  sda3  sda4  sda5 
[root@localhost ~]#
说明:此时己经找到新的分区【sda5】

四、修改/etc/mke2fd.conf
shell#vim /etc/mke2fs.conf
[fs_types]
        ext3 = {
                features = has_journal
        }
        ext4 = {
                features = has_journal,extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize
                auto_64-bit_support = 1  #添加这一行
                inode_size = 256
        }
 
五、下载e2fsprogs-1.42.13.tar.gz
shell#wget -c http://jaist.dl.sourceforge.net/project/e2fsprogs/e2fsprogs/v1.42.13/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
 
六、格式化分区
[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"
 
mke2fs格式说明:
-b<区块大小>:指定区块大小,单位为字节;
-c;检查是否有损坏的区块;
-f<不连续区段大小>:指定不连续区段的大小,单位为字节;
-F:不管指定的设备为何,强制执行mke2fs;
-i<字节>:指定"字节/inode"的比例;
-N:指定要建立的inode数目;
-l<文件>:从指定的文件中,读取文件西中损坏区块的信息;
-L<标签>:设置文件系统的标签名称;
-m<百分比值>:指定给管理员保留区块的比例,预设为5%;
-M:记录最后一次挂入的目录; -q:执行时不显示任何信息;
-r:指定要建立的ext2文件系统版本;
-R=<区块数>:设置磁盘阵列参数;
-S:仅写入superblock与group descriptors,而不更改inode able inode bitmap以及block bitmap;
-v:执行时显示详细信息;
-V:显示版本信息。


七:将对应的分区挂载即可以使用
[root@localhost build]# df -h
Filesystem      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 -i
Filesystem         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
 
查看磁盘信息
[root@localhost build]# tune2fs -l /dev/sda5
tune2fs 1.42.13 (17-May-2015)
Filesystem volume name:   <none>
Last mounted on:          <not available>
Filesystem UUID:          3b5789ee-94c2-4296-bd99-5669200d826a
Filesystem magic number:  0xEF53
Filesystem 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_isize
Filesystem flags:         signed_directory_hash
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              4293781536
Block count:              9695327232
Reserved block count:     484766361
Free blocks:              9426221107
Free inodes:              4293781525
First block:              0
Block size:               4096
Fragment size:            4096
Group descriptor size:    64
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         14512
Inode blocks per group:   907
Flex block group size:    16
Filesystem created:       Thu Oct 15 15:27:56 2015
Last mount time:          Thu Oct 15 15:33:50 2015
Last write time:          Thu Oct 15 15:33:50 2015
Mount count:              1
Maximum mount count:      33
Last checked:             Thu Oct 15 15:27:56 2015
Check interval:           15552000 (6 months)
Next check after:         Tue Apr 12 15:27:56 2016
Lifetime writes:          202 MB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               256
Required extra isize:     28
Desired extra isize:      28
Journal inode:            8
Default directory hash:   half_md4
Directory Hash Seed:      56a5949a-5a49-4bc9-810d-9a9e2aa2109b
Journal backup:           inode blocks


 
(责任编辑:IT)