centos6超20TB磁盘的分区格式化的示例代码
一、服务器环境配置:
1、检查磁盘分区:
近期项目有个服务从虚拟机迁移到物理机,服务磁盘用户自己做了raid为3.8TB2块磁盘配置Raid1然后又3.8TB6块磁盘配置了Raid5,安装操作系统使用的sda3.8TB空间的raid1已分区。3.8TB*6的磁盘sdb共20TB的空间需要分区,并挂载给系统做存储使用。步骤如下:
1.1查询确认sdb状态:
#fdisk-l WARNING:GPT(GUIDPartitionTable)detectedon'/dev/sda'!Theutilfdiskdoesn'tsupportGPT.UseGNUParted. Disk/dev/sda:4000.2GB,4000225165312bytes 255heads,63sectors/track,486333cylinders Units=cylindersof16065*512=8225280bytes Sectorsize(logical/physical):512bytes/4096bytes I/Osize(minimum/optimal):4096bytes/4096bytes Diskidentifier:0x00000000 DeviceBootStartEndBlocksIdSystem /dev/sda112673502147483647+eeGPT Partition1doesnotstartonphysicalsectorboundary. WARNING:GPT(GUIDPartitionTable)detectedon'/dev/sdb'!Theutilfdiskdoesn'tsupportGPT.UseGNUParted Disk/dev/sdb:20001.1GB,20001125826560bytes 255heads,63sectors/track,2431665cylinders Units=cylindersof16065*512=8225280bytes Sectorsize(logical/physical):512bytes/4096bytes I/Osize(minimum/optimal):4096bytes/4096bytes Diskidentifier:0x00000000 DeviceBootStartEndBlocksIdSystem /dev/sdb112673502147483647+eeGPT Partition1doesnotstartonphysicalsectorboundary. Disk/dev/mapper/VolGroup-LogVol00:2531.7GB,2531690283008bytes 255heads,63sectors/track,307793cylinders Units=cylindersof16065*512=8225280bytes Sectorsize(logical/physical):512bytes/4096bytes I/Osize(minimum/optimal):4096bytes/4096bytes Diskidentifier:0x00000000 Disk/dev/mapper/VolGroup-LogVol01:1468.0GB,1468006400000bytes 255heads,63sectors/track,178474cylinders Units=cylindersof16065*512=8225280bytes Sectorsize(logical/physical):512bytes/4096bytes I/Osize(minimum/optimal):4096bytes/4096bytes Diskidentifier:0x00000000
1.2、sdb磁盘分区:
#parted/dev/sdb GNUParted2.1 使用/dev/sdb WelcometoGNUParted!Type'help'toviewalistofcommands. (parted)print#查看当前分区 Model:LSIMRSASRoMB-8i(scsi) Disk/dev/sdb:20.0TB Sectorsize(logical/physical):512B/4096B PartitionTable:gpt NumberStartEndSizeFilesystemName标志 (parted)mkpartprimary0%100%#将磁盘所有空间分为一个区 (parted)print#再次查询磁盘分区 Model:LSIMRSASRoMB-8i(scsi) Disk/dev/sdb:20.0TB Sectorsize(logical/physical):512B/4096B PartitionTable:gpt NumberStartEndSizeFilesystemName标志 11049kB20.0TB20.0TBprimary (parted)quit 信息:Youmayneedtoupdate/etc/fstab.
1.3、正确格式化的方法:
a、使用mkfs命令(如下)格式化是无法格式化的,检查为mkfs.ext4无法格式化16TB以上的分区,原因为Centos6.10e2fsprogs版本为1.41.12,需升级为1.42版本
mkfs.ext4/dev/sdb1#无法如此格式化
b、升级e2fsprogs版本:
tarzvxfe2fsprogs-1.42.10.tar.gz cde2fsprogs-1.42.10 mkdirbuild cdbuild/ ../configure make makeinstall##如有“忽略”错误正常。
c、查询需要分区的扇区大小
#df-h Disk/dev/sdb:20001.1GB,20001125826560bytes 255heads,63sectors/track,2431665cylinders Units=cylindersof16065*512=8225280bytes Sectorsize(logical/physical):512bytes/4096bytes I/Osize(minimum/optimal):4096bytes/4096bytes Diskidentifier:0x00000000 DeviceBootStartEndBlocksIdSystem /dev/sdb112673502147483647+eeGPT Partition1doesnotstartonphysicalsectorboundary.
d、对磁盘重新格式化命令如下:
#mke2fs-O64bit,has_journal,extents,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize-i267350/dev/sdb1 mke2fs1.42.10(18-May-2014) Warning:thefs_typehugeisnotdefinedinmke2fs.conf Creatingfilesystemwith48830868484kblocksand76298240inodes FilesystemUUID:74dabc93-177b-4531-aab9-e55a1e2efe9d Superblockbackupsstoredonblocks: 32768,98304,163840,229376,294912,819200,884736,1605632,2654208, 4096000,7962624,11239424,20480000,23887872,71663616,78675968, 102400000,214990848,512000000,550731776,644972544,1934917632, 2560000000,3855122432 Allocatinggrouptables:完成 正在写入inode表:完成 Creatingjournal(32768blocks):完成 Writingsuperblocksandfilesystemaccountinginformation:完成 Thisfilesystemwillbeautomaticallycheckedevery34mountsor##提示180天问题 180days,whichevercomesfirst.Usetune2fs-cor-itooverride.
e、解决180天问题
#tune2fs-i3650d/dev/sdb1 tune2fs1.42.10(18-May-2014) Settingintervalbetweenchecksto315360000seconds #确认时间正确 #tune2fs-l/dev/sdb1 tune2fs1.42.10(18-May-2014) Filesystemvolumename:Lastmountedon: FilesystemUUID:74dabc93-177b-4531-aab9-e55a1e2efe9d Filesystemmagicnumber:0xEF53 Filesystemrevision#:1(dynamic) Filesystemfeatures:has_journalext_attrdir_indexfiletypeextent64bitflex_bgsparse_superhuge_fileuninit_bgdir_nlinkextra_isize Filesystemflags:signed_directory_hash Defaultmountoptions:user_xattracl Filesystemstate:clean Errorsbehavior:Continue FilesystemOStype:Linux Inodecount:76298240 Blockcount:4883086848 Reservedblockcount:244154342 Freeblocks:4877929145 Freeinodes:76298229 Firstblock:0 Blocksize:4096 Fragmentsize:4096 Groupdescriptorsize:64 Blockspergroup:32768 Fragmentspergroup:32768 Inodespergroup:512 Inodeblockspergroup:32 Flexblockgroupsize:16 Filesystemcreated:FriJun517:08:542020 Lastmounttime:FriJun517:14:342020 Lastwritetime:FriJun517:15:582020 Mountcount:1 Maximummountcount:34 Lastchecked:FriJun517:08:542020##开始时间 Checkinterval:315360000(121months,2weeks,6days) Nextcheckafter:MonJun317:08:542030##最终时间 Lifetimewrites:349MB Reservedblocksuid:0(userroot) Reservedblocksgid:0(grouproot) Firstinode:11 Inodesize:256 Requiredextraisize:28 Desiredextraisize:28 Journalinode:8 Defaultdirectoryhash:half_md4 DirectoryHashSeed:0f4e7ee0-4aec-41cf-b81a-7d5a4ed045c4 Journalbackup:inodeblocks
1.4、挂载磁盘:
a、挂载磁盘
#cd/ #mkdirdata #mount/dev/sdb1/data #df-Th FilesystemTypeSizeUsedAvailUse%Mountedon /dev/mapper/VolGroup-LogVol00 ext42.3T12G2.2T1%/ tmpfstmpfs32G144K32G1%/dev/shm /dev/sda1ext4477M41M412M9%/boot /dev/mapper/VolGroup-LogVol01 ext41.4T70M1.3T1%/home /dev/sdb1ext419T20K18T1%/data
b、设置开机挂载
在文件尾部增加一行如下内容,需注意实际的文件路径。
vim/etc/fstab /dev/sdb1/dataext4defaults00
到此这篇关于centos6超20TB磁盘的分区格式化的示例代码的文章就介绍到这了,更多相关centos6磁盘分区格式化内容请搜索毛票票以前的文章或继续浏览下面的相关文章希望大家以后多多支持毛票票!