centos7.5 挂载超过2T的大硬盘步骤

查看未指派分区名称

格式化分区

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-QT5MqIp2-1665306133915)(/Users/xushuo/Library/Application Support/typora-user-images/image-20220524091037812.png)]

对新磁盘进行分区,由于fdisk仅支持2T以内磁盘分区,但该磁盘大于2T,所以使用parted进行GPT格式分区
parted /dev/sdb

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-XVpX85RV-1665306041316)(/Users/xushuo/Library/Application Support/typora-user-images/image-20220524091111911.png)]

参数计算,克隆一个新会话获取参数值

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-v3WF9qmm-1665306041317)(/Users/xushuo/Library/Application Support/typora-user-images/image-20220524091150534.png)]

(optimal_io_size + alignment_offset)/ physical_block_size = 最终值;

如果optimal_io_size为0,那么我们最好直接使用起始扇区的默认值2048

查看磁盘情况
fdisk -l
再次格式化磁盘
mkfs.ext4 -F /dev/sdb

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-AOfcNz1V-1665306041318)(/Users/xushuo/Library/Application Support/typora-user-images/image-20220524091230534.png)]

创建挂载的目录(自定义即可)
mkdir /data
挂载硬盘
mount /dev/sdb /data
查看磁盘情况

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-ivJUn1Pz-1665306041319)(/Users/xushuo/Library/Application Support/typora-user-images/image-20220524091322743.png)]

添加开机自启
echo /dev/sdb /data ext4 defaults 1 2 >> /etc/fstab
检测是否自动挂载成功

命令行全过程

[root@5c5sb ~]# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
vda    253:0    0   40G  0 disk
└─vda1 253:1    0   40G  0 part /
vdb    253:16   0  1.5T  0 disk
[root@5c5sb ~]# mkfs -t ext4 /dev/vdb
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
98304000 inodes, 393216000 blocks
19660800 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2541748224
12000 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

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

[root@5c5sb ~]# parted /dev/vdb
GNU Parted 3.1
Using /dev/vdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel gpt
Warning: The existing disk label on /dev/vdb will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes
(parted) mkpart primary 2048s 100%
(parted) print
Model: Virtio Block Device (virtblk)
Disk /dev/vdb: 1611GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name     Flags
 1      1049kB  1611GB  1611GB               primary

(parted) align-check optimal 1
1 aligned
(parted) quit
Information: You may need to update /etc/fstab.

[root@5c5sb ~]# cat /sys/block/vdb/queue/optimal_io_size
0
[root@5c5sb ~]# cat /sys/block/vdb/queue/minimum_io_size
512
[root@5c5sb ~]# cat /sys/block/vdb/alignment_offset
0
[root@5c5sb ~]# cat /sys/block/vdb/queue/physical_block_size
512
[root@5c5sb ~]# fdisk -l

Disk /dev/vda: 42.9 GB, 42949672960 bytes, 83886080 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000a6c04

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048    83886046    41941999+  83  Linux
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/vdb: 1610.6 GB, 1610612736000 bytes, 3145728000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt
Disk identifier: 6F176380-7D67-4369-BF59-FFDFCF4D51AF


#         Start          End    Size  Type            Name
 1         2048   3145725951    1.5T  Microsoft basic primary
[root@5c5sb ~]# mkfs.ext4 -F /dev/vd
vda   vda1  vdb   vdb1
[root@5c5sb ~]# mkfs.ext4 -F /dev/vdb

vdb   vdb1
[root@5c5sb ~]# mkfs.ext4 -F /dev/vdb
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
98304000 inodes, 393216000 blocks
19660800 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2541748224
12000 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

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

[root@5c5sb ~]# lsblk  -f
NAME   FSTYPE LABEL UUID                                 MOUNTPOINT
vda
└─vda1 ext4         9f64194b-530f-4d17-bef9-d3607ecb5d55 /
vdb    ext4         0f681d99-f6a4-4d8b-a159-f0045e033ba0
[root@5c5sb ~]# vi /etc/fstab
[root@5c5sb ~]# cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Mon Feb  1 01:29:05 2021
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=9f64194b-530f-4d17-bef9-d3607ecb5d55 /                       ext4    defaults        1 1
UUID=0f681d99-f6a4-4d8b-a159-f0045e033ba0 /data                       ext4    defaults        1 1
[root@5c5sb ~]# mkdir /data

[root@5c5sb ~]#  mount -a
  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值