如何调整分区大小

如何调整分区大小

我正在尝试将/data分区大小从调整40G240G。您能回答以下问题来帮助我理解设置吗?

设置如下:

light-07-data:~ # fdisk -l
GPT PMBR size mismatch (209715199 != 629145599) will be corrected by write.
Disk /dev/sda: 300 GiB, 322122547200 bytes, 629145600 sectors
Disk model: Virtual disk    
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: D482F96A-05F7-47CE-ACCE-29D64D5CC765

Device         Start       End  Sectors  Size Type
/dev/sda1       2048   1026047  1024000  500M EFI System
/dev/sda2    1026048  74426367 73400320   35G Linux filesystem
/dev/sda3  205518848 209715166  4196319    2G Linux swap
/dev/sda4   74426368  95397887 20971520   10G Linux LVM
/dev/sda5   95397888 179283967 83886080   40G Linux LVM

Partition table entries are not in disk order.

light-07-data:~ # lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0  300G  0 disk 
├─sda1   8:1    0  500M  0 part /boot/efi
├─sda2   8:2    0   35G  0 part /
├─sda3   8:3    0    2G  0 part [SWAP]
├─sda4   8:4    0   10G  0 part /home
└─sda5   8:5    0   40G  0 part /data
sr0     11:0    1    4G  0 rom 


light-07-data:~ # pvdisplay
light-07-data:~ # vgdisplay
light-07-data:~ # lvdisplay
light-07-data:~ # 

parted当我尝试调整它的大小时抱怨:

light-07-data:~ # parted /dev/sda
GNU Parted 3.2
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) unit GB                                                          
(parted) print                                                            
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 322GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system     Name  Flags
 1      0.00GB  0.53GB  0.52GB  fat16                 boot, esp
 2      0.53GB  38.1GB  37.6GB  ext4
 4      38.1GB  48.8GB  10.7GB  ext4                  lvm
 5      48.8GB  91.8GB  42.9GB  ext4                  lvm
 3      105GB   107GB   2.15GB  linux-swap(v1)        swap

(parted) resizepart 5                                                     
Warning: Partition /dev/sda5 is being used. Are you sure you want to continue?
Yes/No? Yes
End?  [91.8GB]? 200GB                                                     
Error: Can't have overlapping partitions.
(parted) quit                                       

上述是否意味着我必须删除分区,然后像我上面尝试的那样swap调整分区大小?/data那么,用来resize2fs增长文件系统呢?

为什么parted通知我Warning: Partition /dev/sda5 is being used. Are you sure you want to continue??我该怎么办?

为什么lvdisplay没有列为/dataLVM 卷?这样我就可以通过lvextend?扩展它

最后,我应该在使用之前使用swapoff&吗?swaponparted

相关内容