2T如下的硬盤,分區類型多爲MBR,但MBR的最大容量大約是2.15T,超過3T的硬盤必須用GPT格式。node
1 選擇要格式化的硬盤app
[root@quanzidian /]# parted /dev/sdb GNU Parted 2.1 Using /dev/sdb Welcome to GNU Parted! Type 'help' to view a list of commands. (parted)
2 選擇GPT類型ide
(parted) mklabel gpt Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue? Yes/No?
3 而後輸入yesui
(parted) mklabel gpt Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue? Yes/No? yes (parted)
4 將硬盤分紅一個分區 this
(parted) mkpart prinmary 1 -1 (parted)
5 查看分區 code
(parted) print Model: ATA HGST HUS724040AL (scsi) Disk /dev/sdb: 4001GB Sector size (logical/physical): 512B/512B Partition Table: gpt Number Start End Size File system Name Flags 1 1049kB 4001GB 4001GB ext2 prinmary (parted)
6 退出分區orm
(parted) quit Information: You may need to update /etc/fstab.
7 格式化文件系統爲ext4ip
[root@quanzidian /]# mkfs.ext4 /dev/sdb1 mke2fs 1.41.12 (17-May-2010) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 244195328 inodes, 976754176 blocks 48837708 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=4294967296 29809 block groups 32768 blocks per group, 32768 fragments per group 8192 inodes per group 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 Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 26 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. [root@quanzidian /]#
8 查看分區it
[root@quanzidian /]# parted /dev/sdb print Model: ATA HGST HUS724040AL (scsi) Disk /dev/sdb: 4001GB Sector size (logical/physical): 512B/512B Partition Table: gpt Number Start End Size File system Name Flags 1 1049kB 4001GB 4001GB ext4 prinmary [root@quanzidian /]#
9 建立目錄io
[root@quanzidian /]# mkdir /video
10 給目錄賦權限
[root@quanzidian /]# chmod 755 /video/
11 掛載硬盤
[root@quanzidian /]# mount /dev/sdb1 /video/
12 查看分區
[root@quanzidian /]# df -Hl Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_quanzidian-lv_root 53G 3.8G 47G 8% / tmpfs 2.0G 78k 2.0G 1% /dev/shm /dev/sda2 500M 44M 430M 10% /boot /dev/sda1 210M 271k 210M 1% /boot/efi /dev/mapper/vg_quanzidian-lv_home 927G 76M 880G 1% /home /dev/sdb1 4.0T 72M 3.8T 1% /video [root@quanzidian /]#
13 設置開機啓動
[root@quanzidian /]# vi /etc/fstab
加入
/dev/sdb1 /video ext4 defaults 0 0
wq 保存退出