我做了 pvresize (减少)/dev/sda2
这样我就可以有大约 48 GB 的可用空间...并且我想在该可用空间上创建一个分区,但/dev/sda3
设备没有创建..为什么?我需要重新启动吗? (PV减少后没有重新启动...)
[root@SERVER ~]# parted -s /dev/sda print free
Model: ATA Hitachi HTS72503 (scsi)
Disk /dev/sda: 320GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Number Start End Size Type File system Flags
32,3kB 1049kB 1016kB Free Space
1 1049kB 538MB 537MB primary ext4 boot
2 538MB 272GB 271GB primary lvm
272GB 320GB 48,3GB Free Space
[root@SERVER ~]#
[root@SERVER ~]#
[root@SERVER ~]# parted /dev/sda print
Model: ATA Hitachi HTS72503 (scsi)
Disk /dev/sda: 320GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Number Start End Size Type File system Flags
1 1049kB 538MB 537MB primary ext4 boot
2 538MB 272GB 271GB primary lvm
[root@SERVER ~]#
[root@SERVER ~]#
[root@SERVER ~]# parted /dev/sda mkpart primary 272GB 320GB
Warning: WARNING: the kernel failed to re-read the partition table on /dev/sda (Az eszköz vagy erőforrás foglalt). As a result, it may not reflect all of
your changes until after reboot.
[root@SERVER ~]#
[root@SERVER ~]#
[root@SERVER ~]#
[root@SERVER ~]# parted /dev/sda print
Model: ATA Hitachi HTS72503 (scsi)
Disk /dev/sda: 320GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Number Start End Size Type File system Flags
1 1049kB 538MB 537MB primary ext4 boot
2 538MB 272GB 271GB primary lvm
3 272GB 320GB 48,3GB primary
[root@SERVER ~]#
[root@SERVER ~]# parted -s /dev/sda print free
Model: ATA Hitachi HTS72503 (scsi)
Disk /dev/sda: 320GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Number Start End Size Type File system Flags
32,3kB 1049kB 1016kB Free Space
1 1049kB 538MB 537MB primary ext4 boot
2 538MB 272GB 271GB primary lvm
3 272GB 320GB 48,3GB primary
320GB 320GB 352kB Free Space
[root@SERVER ~]#
[root@SERVER ~]#
[root@SERVER ~]#
[root@SERVER ~]# env LC_MESSAGES=EN ls -la /dev/sda*
brw-rw----. 1 root disk 8, 0 Jun 29 18:53 /dev/sda
brw-rw----. 1 root disk 8, 1 Jun 28 12:56 /dev/sda1
brw-rw----. 1 root disk 8, 2 Jun 28 12:56 /dev/sda2
[root@SERVER ~]#
[root@SERVER ~]#
[root@SERVER ~]#
[root@SERVER ~]# partprobe
Warning: WARNING: the kernel failed to re-read the partition table on /dev/sda (Az eszköz vagy erőforrás foglalt). As a result, it may not reflect all of your changes until after reboot.
[root@SERVER ~]#
[root@SERVER ~]#
[root@SERVER ~]# env LC_MESSAGES=EN ls -la /dev/sda*
brw-rw----. 1 root disk 8, 0 Jun 29 18:55 /dev/sda
brw-rw----. 1 root disk 8, 1 Jun 28 12:56 /dev/sda1
brw-rw----. 1 root disk 8, 2 Jun 28 12:56 /dev/sda2
[root@SERVER ~]#
[root@SERVER ~]# env LC_MESSAGES=EN fdisk -l
Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x0007e24d
Device Boot Start End Blocks Id System
/dev/sda1 * 1 66 524288 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 66 33039 264859648 8e Linux LVM
/dev/sda3 33039 38914 47185920 83 Linux
[root@SERVER ~]# head -1 /etc/issue
Scientific Linux release 6.4 (Carbon)
[root@SERVER ~]#
更新:
[root@SERVER ~]# kpartx -av /dev/sda
device-mapper: reload ioctl on sda1 failed: Invalid argument
create/reload failed on sda1
add map sda1 (0:0): 0 1048576 linear /dev/sda 2048
device-mapper: reload ioctl on sda2 failed: Invalid argument
create/reload failed on sda2
add map sda2 (0:0): 0 529719296 linear /dev/sda 1050624
device-mapper: reload ioctl on sda3 failed: Invalid argument
create/reload failed on sda3
add map sda3 (0:0): 0 94371840 linear /dev/sda 530769920
[root@SERVER ~]#
[root@SERVER ~]# env LC_MESSAGES=EN ls -la /dev/sda*
brw-rw----. 1 root disk 8, 0 Jun 29 22:05 /dev/sda
brw-rw----. 1 root disk 8, 1 Jun 28 12:56 /dev/sda1
brw-rw----. 1 root disk 8, 2 Jun 28 12:56 /dev/sda2
[root@SERVER ~]#
[root@SERVER ~]#
[root@SERVER ~]#
[root@SERVER ~]# sh rescan-scsi-bus.sh
WARN: /usr/bin/sg_inq not present -- please install sg3_utils
or rescan-scsi-bus.sh might not fully work.
Host adapter 0 (ata_piix) found.
Host adapter 1 (ata_piix) found.
Host adapter 2 (ahci) found.
Host adapter 3 (ahci) found.
Host adapter 4 (ahci) found.
Scanning SCSI subsystem for new devices
Scanning host 0 for SCSI target IDs 0 1 2 3 4 5 6 7, all LUNs
Scanning for device 0 0 0 0 ...
OLD: Host: scsi0 Channel: 00 Id: 00 Lun: 00
Vendor: MATSHITA Model: DVD/CDRW UJDA775 Rev: CB03
Type: CD-ROM ANSI SCSI revision: 05
Scanning host 1 for SCSI target IDs 0 1 2 3 4 5 6 7, all LUNs
Scanning host 2 for SCSI target IDs 0 1 2 3 4 5 6 7, all LUNs
Scanning for device 2 0 0 0 ...
OLD: Host: scsi2 Channel: 00 Id: 00 Lun: 00
Vendor: ATA Model: Hitachi HTS72503 Rev: GHBO
Type: Direct-Access ANSI SCSI revision: 05
Scanning host 3 for SCSI target IDs 0 1 2 3 4 5 6 7, all LUNs
Scanning host 4 for SCSI target IDs 0 1 2 3 4 5 6 7, all LUNs
0 new device(s) found.
0 device(s) removed.
[root@SERVER ~]#
[root@SERVER ~]#
[root@SERVER ~]# env LC_MESSAGES=EN ls -la /dev/sda*
brw-rw----. 1 root disk 8, 0 Jun 29 22:05 /dev/sda
brw-rw----. 1 root disk 8, 1 Jun 28 12:56 /dev/sda1
brw-rw----. 1 root disk 8, 2 Jun 28 12:56 /dev/sda2
[root@SERVER ~]#
答案1
不需要重启,直接运行克帕特克斯( kpartx /dev/sda
)重新扫描sda的分区表。
答案2
您正在运行旧版本,parted
该版本仍然使用 BLKRRPART ioctl 来让内核重新加载分区表,而不是较新的 BLKPG ioctl。 BLKRRPART 仅适用于没有任何分区正在使用的磁盘,因此,会出现通知内核更改并建议您重新启动的错误。
更新到最新版本的parted,您将不会收到此错误,或者只需重新启动即可使更改生效,如消息所述。根据系统上 util-linux 软件包的旧版本,您也许可以使用partx -a
或 对于更新的版本partx -u
来添加新分区,而无需重新启动。