佳木斯湛栽影视文化发展公司

主頁 > 知識庫 > centos6超20TB磁盤的分區(qū)格式化的示例代碼

centos6超20TB磁盤的分區(qū)格式化的示例代碼

熱門標(biāo)簽:檢查注冊表項 網(wǎng)站建設(shè) 硅谷的囚徒呼叫中心 使用U盤裝系統(tǒng) 百度競價點擊價格的計算公式 美圖手機 智能手機 阿里云

一、服務(wù)器環(huán)境配置:

1、檢查磁盤分區(qū):

近期項目有個服務(wù)從虛擬機遷移到物理機,服務(wù)磁盤用戶自己做了raid為3.8TB 2塊磁盤配置 Raid1然后又3.8TB 6塊磁盤配置了Raid5,安裝操作系統(tǒng)使用的sda 3.8TB空間的raid1已分區(qū)。3.8TB*6的磁盤sdb共20TB的空間需要分區(qū),并掛載給系統(tǒng)做存儲使用。步驟如下:

1.1查詢確認(rèn)sdb狀態(tài):

# fdisk -l
WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.
Disk /dev/sda: 4000.2 GB, 4000225165312 bytes
255 heads, 63 sectors/track, 486333 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

  Device Boot   Start     End   Blocks  Id System
/dev/sda1        1   267350 2147483647+ ee GPT
Partition 1 does not start on physical sector boundary.
WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted
Disk /dev/sdb: 20001.1 GB, 20001125826560 bytes
255 heads, 63 sectors/track, 2431665 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

  Device Boot   Start     End   Blocks  Id System
/dev/sdb1        1   267350 2147483647+ ee GPT
Partition 1 does not start on physical sector boundary.

Disk /dev/mapper/VolGroup-LogVol00: 2531.7 GB, 2531690283008 bytes
255 heads, 63 sectors/track, 307793 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

Disk /dev/mapper/VolGroup-LogVol01: 1468.0 GB, 1468006400000 bytes
255 heads, 63 sectors/track, 178474 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

1.2、sdb磁盤分區(qū):

# parted /dev/sdb
GNU Parted 2.1
使用 /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.                       
(parted) print    #查看當(dāng)前分區(qū)                       
Model: LSI MRSASRoMB-8i (scsi)
Disk /dev/sdb: 20.0TB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt

Number Start End Size File system Name 標(biāo)志

(parted) mkpart primary 0% 100%    #將磁盤所有空間分為一個區(qū)                            
(parted) print      #再次查詢磁盤分區(qū)                         
Model: LSI MRSASRoMB-8i (scsi)
Disk /dev/sdb: 20.0TB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt

Number Start  End   Size  File system Name   標(biāo)志
 1   1049kB 20.0TB 20.0TB        primary                                 
(parted) quit                               
信息: You may need to update /etc/fstab.

1.3、正確格式化的方法:

a、使用mkfs命令(如下)格式化是無法格式化的,檢查為mkfs.ext4無法格式化16TB以上的分區(qū),原因為Centos6.10 e2fsprogs版本為1.41.12,需升級為1.42版本

mkfs.ext4 /dev/sdb1     #無法如此格式化

b、升級e2fsprogs版本:

tar zvxf e2fsprogs-1.42.10.tar.gz 
cd e2fsprogs-1.42.10
mkdir build
cd build/
../configure 
make
make install  ##如有“忽略”錯誤正常。

c、查詢需要分區(qū)的扇區(qū)大小

# df -h
Disk /dev/sdb: 20001.1 GB, 20001125826560 bytes
255 heads, 63 sectors/track, 2431665 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

  Device Boot   Start     End   Blocks  Id System
/dev/sdb1        1   267350 2147483647+ ee GPT
Partition 1 does not start on physical sector boundary.

d、對磁盤重新格式化命令如下:

# mke2fs -O 64bit,has_journal,extents,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize -i 267350 /dev/sdb1
mke2fs 1.42.10 (18-May-2014)

Warning: the fs_type huge is not defined in mke2fs.conf

Creating filesystem with 4883086848 4k blocks and 76298240 inodes
Filesystem UUID: 74dabc93-177b-4531-aab9-e55a1e2efe9d
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: 完成              
正在寫入inode表: 完成              
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成    

This filesystem will be automatically checked every 34 mounts or      ##提示180天問題
180 days, whichever comes first. Use tune2fs -c or -i to override.

e、解決180天問題

# tune2fs -i 3650d /dev/sdb1
tune2fs 1.42.10 (18-May-2014)
Setting interval between checks to 315360000 seconds

#確認(rèn)時間正確
# tune2fs -l /dev/sdb1
tune2fs 1.42.10 (18-May-2014)
Filesystem volume name:  <none>
Last mounted on:     <not available>
Filesystem UUID:     74dabc93-177b-4531-aab9-e55a1e2efe9d
Filesystem magic number: 0xEF53
Filesystem revision #:  1 (dynamic)
Filesystem features:   has_journal ext_attr dir_index filetype 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:       76298240
Block count:       4883086848
Reserved block count:   244154342
Free blocks:       4877929145
Free inodes:       76298229
First block:       0
Block size:        4096
Fragment size:      4096
Group descriptor size:  64
Blocks per group:     32768
Fragments per group:   32768
Inodes per group:     512
Inode blocks per group:  32
Flex block group size:  16
Filesystem created:    Fri Jun 5 17:08:54 2020
Last mount time:     Fri Jun 5 17:14:34 2020
Last write time:     Fri Jun 5 17:15:58 2020
Mount count:       1
Maximum mount count:   34
Last checked:       Fri Jun 5 17:08:54 2020           ##開始時間
Check interval:      315360000 (121 months, 2 weeks, 6 days)
Next check after:     Mon Jun 3 17:08:54 2030           ##最終時間
Lifetime writes:     349 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:   0f4e7ee0-4aec-41cf-b81a-7d5a4ed045c4
Journal backup:      inode blocks

1.4、掛載磁盤:

a、掛載磁盤

# cd /
# mkdir data
# mount /dev/sdb1 /data
# df -Th
Filesystem      Type  Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-LogVol00
           ext4  2.3T  12G 2.2T  1% /
tmpfs        tmpfs  32G 144K  32G  1% /dev/shm
/dev/sda1      ext4  477M  41M 412M  9% /boot
/dev/mapper/VolGroup-LogVol01
           ext4  1.4T  70M 1.3T  1% /home
/dev/sdb1      ext4  19T  20K  18T  1% /data

b、設(shè)置開機掛載

在文件尾部增加一行如下內(nèi)容,需注意實際的文件路徑。

vim /etc/fstab

/dev/sdb1        /data          ext4  defaults    0 0

到此這篇關(guān)于centos6超20TB磁盤的分區(qū)格式化的示例代碼的文章就介紹到這了,更多相關(guān)centos6磁盤分區(qū)格式化內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

標(biāo)簽:湘潭 湖北 通遼 煙臺 山南 懷化 賀州 黃山

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《centos6超20TB磁盤的分區(qū)格式化的示例代碼》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266
    铅山县| 抚远县| 若尔盖县| 孟村| 房产| 阳泉市| 昆明市| 泌阳县| 屏东市| 郁南县| 木里| 安阳县| 广汉市| 诸暨市| 叙永县| 苏尼特左旗| 苗栗市| 侯马市| 汝城县| 英德市| 个旧市| 定西市| 青铜峡市| 水富县| 淄博市| 句容市| 丰镇市| 渭源县| 永仁县| 乐业县| 南通市| 高陵县| 肇源县| 措美县| 沂南县| 关岭| 依安县| 南部县| 精河县| 天长市| 凌源市|