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

文章目录

        • 查看未指派分区名称
        • 格式化分区
        • 对新磁盘进行分区,由于fdisk仅支持2T以内磁盘分区,但该磁盘大于2T,所以使用parted进行GPT格式分区
        • 参数计算,克隆一个新会话获取参数值
        • 查看磁盘情况
        • 再次格式化磁盘
        • 创建挂载的目录(自定义即可)
        • 挂载硬盘
        • 查看磁盘情况
        • 添加开机自启
        • 检测是否自动挂载成功
      • 命令行全过程

查看未指派分区名称

centos7.5 挂载超过2T的大硬盘步骤_第1张图片

格式化分区

centos7.5 挂载超过2T的大硬盘步骤_第2张图片

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

centos7.5 挂载超过2T的大硬盘步骤_第3张图片

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

centos7.5 挂载超过2T的大硬盘步骤_第4张图片

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

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

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

centos7.5 挂载超过2T的大硬盘步骤_第5张图片

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

centos7.5 挂载超过2T的大硬盘步骤_第6张图片

添加开机自启
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

你可能感兴趣的:(linux,linux,服务器)