Re: Weird behaviour with lsblk and freshly created loop device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> From: Francis Moreau <francis.moro@xxxxxxxxx>

> Right after associating a loop device with a disk image file, I'm using
> lsblk to retrieve some info about the partitions.
> 
> If I'm doing this as root:
> 
>   $ losetup /dev/loop0 /tmp/installer-disks/disk0.img && lsblk -n --raw
> --paths -o NAME,PARTTYPE /dev/loop0 && losetup -d /dev/loop0
> 
> then the output is missing the parttypes:
> 
>   /dev/loop0
>   /dev/loop0p1
>   /dev/loop0p2
> 
> However adding a sleep or 'udevadm settle' after setting the loop device
> the parttypes are correctly showed:

It looks like the process of determining the partitions is
asynchronous, and is not assured of being completed when losetup
returns.

What happens when you add -P to losetup?  The manual page (for Fedora
19) says "force kernel to scan partition table on newly created loop
device", which suggests that the partition scan will be completed by
the time losetup returns.

Dale
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux