今天使用之前的硬盘挂载文章(468.【数据库】阿里云服务器挂载硬盘)挂载公司服务器上 4T 的硬盘,结果,挂载完我一看,就发现:4T 的硬盘,挂载上之后,只显示 2T。
网上查了下,发现 fdisk
建不了大于 2T 的分区。今天记录下使用 parted
工具来创建大于 2T 的分区。
一、创建分区
[root@k8s0 shell_sync_scripts]# parted /dev/sdb
GNU Parted 3.1
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(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) mkpart primary xfs 0% 100%
(parted) print
Model: LSI MR9240-8i (scsi)
Disk /dev/sdb: 4000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 4000GB 4000GB ext4 primary
(parted) quit
Information: You may need to update /etc/fstab.
二、创建文件系统
[root@k8s0 shell_sync_scripts]# mkfs.xfs /dev/sdb1
meta-data=/dev/sdb1 isize=512 agcount=4, agsize=244154240 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=976616960, imaxpct=5
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=476863, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
三、挂载目录
mount /dev/sdb1 /var/lib/containerd
四、设置开机自动挂载
echo $( blkid /dev/sdb1 | awk '{print $2}' | sed 's/\"//g' ) /var/lib/containerd xfs defaults 0 0 >> /etc/fstab
五、验证
可以看到,这会显示有3.7T了,大于2T的分区建立完成,并且成功挂载。