Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I did a pvresize (decrease) on /dev/sda2 so that I can have about 48 GBytes free... and I wanted to create a partition on that free space, but the /dev/sda3 device didn't created.. why? Do I need a reboot for it? (didn't rebooted after the reducing of the 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 ~]# 

UPDATE:

[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 ~]# 
share|improve this question
add comment

2 Answers

up vote 0 down vote accepted

You are running an old version of parted which still uses the BLKRRPART ioctl to have the kernel reload the partition table, instead of the newer BLKPG ioctl. BLKRRPART only works on a disk that does not have any partitions in use, hence, the error about informing the kernel of the changes, and suggesting you reboot.

Update to a recent version of parted and you won't get this error, or just reboot for the changes to take affect, as the message said. Depending on how old the util-linux package is on your system, you may be able to use partx -a or for more recent releases, partx -u to add the new partition without rebooting.

share|improve this answer
    
reboot helped.. –  gasko peter Jul 1 '13 at 6:16
add comment

You don't need to reboot, just run kpartx (kpartx /dev/sda) to rescan the partition table of sda.

share|improve this answer
    
wow, I didn't knew about this command... :D I updated the Question, MANY THANKS! –  gasko peter Jun 29 '13 at 20:04
    
kpartx -av /dev/sda to get it to create the mappings. –  jsbillings Jun 29 '13 at 20:08
    
updated it, still not ok :D –  gasko peter Jun 29 '13 at 20:18
    
You want partx or partprobe, which operate on regular disks, not kpartx, which operates on device mapper targets. –  psusi Jun 30 '13 at 3:24
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.