我正在尝试扩展当前的磁盘,但是当我使用pvcreate
最新的分区时,它说下面找不到命令详细信息。
我注意到的一件事是分区后磁盘标签类型从 DOS 更改为 GPT 我不确定这意味着什么
login as: root
[email protected]'s password:
Last login: Wed Oct 11 01:03:01 2017 from 10.10.222.122
[root@dpnjsv2-centos7-base ~]# fdisk /dev/sda
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): n
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): p
Partition number (2-4, default 2): 4
First sector (41943040-73400319, default 41943040):
Using default value 41943040
Last sector, +sectors or +size{K,M,G} (41943040-73400319, default 73400319):
Using default value 73400319
Partition 4 of type Linux and of size 15 GiB is set
Command (m for help): t
Partition number (1,4, default 4): 4
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'
Command (m for help): p
Disk /dev/sda: 37.6 GB, 37580963840 bytes, 73400320 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: 0x00000000
Device Boot Start End Blocks Id System
/dev/sda1 1 41943039 20971519+ ee GPT
/dev/sda4 41943040 73400319 15728640 8e Linux LVM
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
You have new mail in /var/spool/mail/root
[root@dpnjsv2-centos7-base ~]# partprobe
[root@dpnjsv2-centos7-base ~]# pvcreate /dev/sda4
**Device /dev/sda4 not found (or ignored by filtering).**
You have new mail in /var/spool/mail/root
[root@dpnjsv2-centos7-base ~]# fdisk /dev/sda
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/sda: 37.6 GB, 37580963840 bytes, 73400320 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
# Start End Size Type Name
1 2048 411647 200M EFI System EFI System Partition
2 411648 1435647 500M Microsoft basic
3 1435648 41940991 19.3G Linux LVM
Command (m for help): pvcreate 1
Disk /dev/sda: 37.6 GB, 37580963840 bytes, 73400320 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
# Start End Size Type Name
1 2048 411647 200M EFI System EFI System Partition
2 411648 1435647 500M Microsoft basic
3 1435648 41940991 19.3G Linux LVM
答案1
您发布的输出看起来有点不一致。首先您创建了 /dev/sda4 分区,但后来它没有列出。它真的存在吗?
如果是,很可能您在 /dev/sda4 分区的开头有一些垃圾,并且 pvcreate 无法接受它。尝试清理前几兆字节,例如:
dd if=/dev/zero of=/dev/sda4 bs=1M count=20
我们最近也遇到过类似的情况,我们只是尝试使用完整的 /dev/sdb 磁盘作为新的 VG。
尽管您还没有 sda2/3,但您已经创建了 sda4:
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): p
Partition number (2-4, default 2): 4
这看起来确实像是两个同名的不同节点。