如何将一个三T的硬盘分区并做LVM

解决方案:

增加磁盘 -> 初始化物理卷 -> 扩容卷组 -> 扩容逻辑卷

因为fdisk不能创建大于2T的分区,创建大分区得用parted

parted将硬盘进行分区:

查看磁盘信息,这里将vdc进行分区

[root@ftp 05]# lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sr0              11:0    1 1024M  0 rom  
vda             252:0    0   40G  0 disk 
├─vda1          252:1    0    1G  0 part /boot
└─vda2          252:2    0   39G  0 part 
  ├─centos-root 253:0    0   35G  0 lvm  /
  └─centos-swap 253:1    0    4G  0 lvm  [SWAP]
vdb             252:16   0    2T  0 disk /home/dpan
vdc             252:32   0    3T  0 disk 
​

parted /dev/vdc

[root@ftp 05]# parted /dev/vdc
GNU Parted 3.1 
Using /dev/vdc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p                                                                
Model: Virtio Block Device (virtblk)
Disk /dev/vdc: 3299GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 
​
Number  Start  End  Size  Type  File system  Flags
​
(parted) mklabel                                                          
New disk label type? gpt                                                  
Warning: The existing disk label on /dev/vdc will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes                                                               
(parted) p                                                                
Model: Virtio Block Device (virtblk)
Disk /dev/vdc: 3299GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 
​
Number  Start  End  Size  File system  Name  Flags
​
(parted) mkpart primary 4096s 100%
(parted) p                                                                
Model: Virtio Block Device (virtblk)
Disk /dev/vdc: 3299GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 
​
Number  Start   End     Size    File system  Name     Flags
 1      2097kB  3299GB  3299GB               primary
#这里已经分区完成了
​
(parted) toggle 1 lvm        #打个标签                                             
(parted) p                                                                
Model: Virtio Block Device (virtblk)
Disk /dev/vdc: 3299GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 
​
Number  Start   End     Size    File system  Name     Flags
 1      2097kB  3299GB  3299GB               primary  lvm
​
(parted) quit                                                             
Information: You may need to update /etc/fstab.
​
#使用命令查看
#lsblk

分区完成。下面进行LVM操作,创建相应的PV VG LV

LVM相关操作,参考LVM管理进行后续操作

#完成效果如图
#df -h