gdisk
2017-10-16GPT fdisk
gdisk /dev/sda
GPT fdisk (gdisk) version 0.8.6
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Command (? for help): ?
b back up GPT data to a file
c change a partition's name
d delete a partition
i show detailed information on a partition
l list known partition types
n add a new partition
o create a new empty GUID partition table (GPT)
p print the partition table
q quit without saving changes
r recovery and transformation options (experts only)
s sort partitions
t change a partition's type code
v verify disk
w write table to disk and exit
x extra functionality (experts only)
? print this menu
fdisk 创建MBR分区
gdisk 创建GPT分区
parted 高级分区操作(创建、复制、调整大小等)
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 558.9G 0 disk
├─sda1 8:1 0 1000M 0 part /boot/efi
├─sda2 8:2 0 97.7G 0 part /
├─sda3 8:3 0 15.6G 0 part [SWAP]
└─sda4 8:4 0 444.7G 0 part /panda
sr0 11:0 1 1024M 0 rom
partx同步内存信息与硬盘分区表
1、增加磁盘空间后
yum -y install gdisk
要不然会报:no tools available to resize disk with 'gpt'
2、fdisk -lu
growpart /dev/vdb 1
注意有个空格,
sfdisk: /dev/vdb: does not contain a recognized partition table 继续执行就可以了
3、 parted /dev/vdb print 查看分区类型
resize2fs /dev/vdb1
4、resize2fs: Bad magic number in super-block while trying to open /dev/vdb1
经查询资料后得知,不同格式的文件需要使用不同命令。
这个文件是xfs格式的,所以需要使用xfs_growfs命令。
xfs_growfs /jesong/
或者
xfs_growfs /dev/vdb1