在 RHEL 7 中出现 "WARNING:Re-reading the partition table failed with error 16:Device or resource busy"
Issue
- 如何在不重启系统的情况下,在 RHEL 7 中创建一个新分区?
- 磁盘
/dev/sdX
用于系统分区,例如用于/boot
和/(root)
。如何在不重启系统的情况下,在它的上面创建一个新的分区。 - 在使用
fdisk
命令创建新分区时,出现以下错误:但是,分区被创建并可以使用。
[root@hostname ~]# 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): p
Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 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: 0x0004886a
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 23570431 11272192 8e Linux LVM
Command (m for help): n
Partition type:
p primary (2 primary, 0 extended, 2 free)
e extended
Select (default p): p
Partition number (3,4, default 3): 3
First sector (23570432-41943039, default 23570432):
Using default value 23570432
Last sector, +sectors or +size{K,M,G} (23570432-41943039, default 41943039): +2G
Partition 3 of type Linux and of size 2 GiB is set
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.
[root@hostname ~]# partprobe
[root@hostname ~]# fdisk -l
Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 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: 0x0004886a
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 23570431 11272192 8e Linux LVM
/dev/sda3 23570432 27764735 2097152 83 Linux
[root@hostname ~]# pvcreate /dev/sda3
Physical volume "/dev/sda3" successfully created
[root@hostname ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 rhel_hostname lvm2 a-- 10.75g 4.00m
/dev/sda3 lvm2 a-- 2.00g 2.00g
- 对于 RHEL 6,当出现上述错误时,代表 partprobe 没有读取分区表。
Environment
- Red Hat Enterprise Linux 7
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.