You are not logged in.

#1 2015-04-14 14:48:07

Jeffrey4l
Member
Registered: 2015-04-14
Posts: 4

[Solved] Kernel failed to re-read the partition for Udisk

re-produce procedure

* plug a udisk
* use `fidsk` to partition the disk `fdisk /dev/sdb`
* save the partition. Error will raise.

Here is the error raised by fdisk

Disk /dev/sdb: 3.7 GiB, 3974103040 bytes, 7761920 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
Disklabel type: dos
Disk identifier: 0x2dfbdb2a

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 
First sector (2048-7761919, default 2048): 
Last sector, +sectors or +size{K,M,G,T,P} (2048-7761919, default 7761919): 

Created a new partition 1 of type 'Linux' and of size 3.7 GiB.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Success

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.

When use the kpartx to re-read the partition, it still raise error

# sudo kpartx -a -s /dev/sdb                                                                                                           
device-mapper: reload ioctl on sdb1 failed: Invalid argument
create/reload failed on sdb1

following is the error message when run strace

# sudo strace kpartx -a -s /dev/sdb
......
open("/etc/udev/udev.conf", O_RDONLY|O_CLOEXEC) = 4
fstat(4, {st_mode=S_IFREG|0644, st_size=49, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2f5cff0000
read(4, "# see udev.conf(5) for details\n\n"..., 4096) = 49
read(4, "", 4096)                       = 0
close(4)                                = 0
munmap(0x7f2f5cff0000, 4096)            = 0
access("/run/udev/control", F_OK)       = 0
open("/dev/urandom", O_RDONLY)          = 4
read(4, "\v~", 2)                       = 2
semget(0xd4d7e0b, 1, IPC_CREAT|IPC_EXCL|0600) = 1179649
semctl(1179649, 0, SETVAL, 0x1)         = 0
semctl(1179649, 0, GETVAL, 0xffffffffffffffff) = 1
close(4)                                = 0
semop(1179649, {{0, 1, 0}}, 1)          = 0
semctl(1179649, 0, GETVAL, 0xffffffffffffffff) = 2
ioctl(3, DM_DEV_CREATE, 0xf4ff30)       = 0
ioctl(3, DM_TABLE_LOAD, 0xf4ff10)       = -1 EINVAL (Invalid argument)
write(2, "device-mapper: reload ioctl on s"..., 60device-mapper: reload ioctl on sdb1 failed: Invalid argument) = 60
write(2, "\n", 1
)                
......

But if you unplug the disk and plug the disk again. The partition is re-read and I can see the sdb1.

My system is the latest ( 2015-4-14 ).

Did anybody meet this error and tell me how to fix it ? Thanks a lot.

Last edited by Jeffrey4l (2015-04-30 02:01:35)

Offline

#2 2015-04-14 16:15:49

Spider.007
Member
Registered: 2004-06-20
Posts: 1,176

Re: [Solved] Kernel failed to re-read the partition for Udisk

After plugging in the disk the first time; have a look at `mount`; it will probably be mounted automatically by some process. You should unmount it before attempting to change the partition table

Last edited by Spider.007 (2015-04-14 16:16:05)

Offline

#3 2015-04-15 01:39:54

Jeffrey4l
Member
Registered: 2015-04-14
Posts: 4

Re: [Solved] Kernel failed to re-read the partition for Udisk

@Spider.007 I checked that. It is not mounted.

Actually, I first meet this issue by following step.

* qemu-img create disk 10G
* qemu-nbd -c /dev/nbd0 disk
* fdisk /dev/nbd0

write the partition table and raise the above error.

Offline

#4 2015-04-15 18:13:03

nomorewindows
Member
Registered: 2010-04-03
Posts: 3,541

Re: [Solved] Kernel failed to re-read the partition for Udisk

I usually use partprobe.  If you are using a sensitive partition like / or /usr I'd reboot.


I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.

Offline

#5 2015-04-15 18:23:48

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: [Solved] Kernel failed to re-read the partition for Udisk

Jeffrey4l wrote:

Actually, I first meet this issue by following step.

* qemu-img create disk 10G
* qemu-nbd -c /dev/nbd0 disk
* fdisk /dev/nbd0

write the partition table and raise the above error.

I don't get any error when writing the table to an nbd.

It's probably not relevant, but I load the nbd module manually with "modprobe nbd nbds_max=2 max_part=4"


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#6 2015-04-16 14:16:11

Jeffrey4l
Member
Registered: 2015-04-14
Posts: 4

Re: [Solved] Kernel failed to re-read the partition for Udisk

alphaniner wrote:
Jeffrey4l wrote:

Actually, I first meet this issue by following step.

* qemu-img create disk 10G
* qemu-nbd -c /dev/nbd0 disk
* fdisk /dev/nbd0

write the partition table and raise the above error.

I don't get any error when writing the table to an nbd.

It's probably not relevant, but I load the nbd module manually with "modprobe nbd nbds_max=2 max_part=4"

I really load that module.

I also tried losetup file, it also raised error when write the partition info.

So i think whether i forget some module or service which is used by hot re-partition.

Offline

#7 2015-04-30 02:00:56

Jeffrey4l
Member
Registered: 2015-04-14
Posts: 4

Re: [Solved] Kernel failed to re-read the partition for Udisk

I found the root cause.

The nbd use a `max_part` parameter and prevent to use partition in default( default value is 0). Change it to 32 works.

# cat /etc/modprobe.d/qemu.conf                                                                                                        
options nbd max_part=32

Offline

Board footer

Powered by FluxBB