linux 格式化大于2T的硬盘

孤人 提交于 2019-12-29 22:17:28

【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>>

2T以下的硬盘,分区类型多为MBR,但MBR的最大容量大约是2.15T,超过3T的硬盘必须用GPT格式。

1  选择要格式化的硬盘

[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类型

(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  然后输入yes

(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  将硬盘分成一个分区  

(parted) mkpart  prinmary 1  -1
(parted)

5  查看分区 

(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  退出分区

(parted) quit
Information: You may need to update /etc/fstab.

7  格式化文件系统为ext4

[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  查看分区

[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  创建目录

[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  保存退出

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!