在需要对一个8T的硬盘分区时,使用fdisk不能建立分区。原因是fdisk只能建立2TB大小的分区。如果大于2T需要采用GPT磁盘模式。
1、使用parted将DOS转化成GPT格式,使用fdisk分区
parted /dev/sdb
partedmklable gpt 将MBR磁盘格式化为GPT
[root@server soft_ware]# fdisk /dev/sdb
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p
Disk /dev/sdb: 8000.5 GB, 8000450330624 bytes, 15625879552 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: gpt
Disk identifier: D65379E4-C8BF-4D66-A5E6-EC87726EBD09
# Start End Size Type Name
Command (m for help): n
Partition number (1-128, default 1):
First sector (34-15625879518, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-15625879518, default 15625879518):
Created partition 1
Command (m for help): p
Disk /dev/sdb: 8000.5 GB, 8000450330624 bytes, 15625879552 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: gpt
Disk identifier: D65379E4-C8BF-4D66-A5E6-EC87726EBD09
# Start End Size Type Name
1 2048 15625879518 7.3T Linux filesyste
2、创建pv物理卷
[root@server soft_ware]# pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created.
[root@server ~]# pvscan
PV /dev/sda2 VG centos lvm2 [<1.82 TiB / 0 free]
PV /dev/sdb1 lvm2 [<7.28 TiB]
Total: 2 [9.09 TiB] / in use: 1 [<1.82 TiB] / in no VG: 1 [<7.28 TiB]
3、创建vg卷组
[root@server ~]# vgcreate VG_DATA /dev/sdb1
Volume group "VG_DATA" successfully created
[root@server ~]# vgs
VG #PV #LV #SN Attr VSize VFree
VG_DATA 1 0 0 wz--n- <7.28t <7.28t
centos 1 2 0 wz--n- <1.82t 0
4、创建lv逻辑卷
[root@server ~]# lvcreate -l +100%FREE -n LV_DATA VG_DATA
Logical volume "LV_DATA" created.
[root@server ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
LV_DATA VG_DATA -wi-a----- <7.28t
root centos -wi-ao---- 1.81t
swap centos -wi-ao---- 4.00g
[root@server ~]# vgdisplay
--- Volume group ---
VG Name VG_DATA
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 2
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size <7.28 TiB
PE Size 4.00 MiB
Total PE 1907455
Alloc PE / Size 1907455 / <7.28 TiB
Free PE / Size 0 / 0
VG UUID OLPgw8-U45U-qsnK-9Er0-l415-7kue-SyDnlz
5、格式化逻辑卷
[root@server ~]# mkfs.xfs /dev/mapper/VG_DATA-LV_DATA
meta-data=/dev/mapper/VG_DATA-LV_DATA isize=512 agcount=8, agsize=268435455 blks
= sectsz=4096 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=1953233920, imaxpct=5
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=521728, version=2
= sectsz=4096 sunit=1 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
6、创建数据文件夹,将逻辑卷挂载到/data
[root@server ~]# mkdir /u01
[root@server ~]# mount /dev/mapper/VG_DATA-LV_DATA /u01/
[root@server ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 1.9T 19G 1.8T 1% /
devtmpfs 63G 0 63G 0% /dev
………………
/dev/mapper/VG_DATA-LV_DATA 7.3T 33M 7.3T 1% /u01
7、添加开机挂载
[root@cwaiserver ~]# vim /etc/fstab
[root@cwaiserver ~]# cat /etc/fstab |grep u01
/dev/mapper/VG_DATA-LV_DATA /u01 xfs defaults 0 0
8、检查挂载
[root@server ~]# mount -a
[root@server ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 1.9T 21G 1.8T 2% /
……………………
/dev/mapper/VG_DATA-LV_DATA 7.3T 33M 7.3T 1% /u01
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




