[CentOS] Failed to create /dev/loop0p* entries for partitions inside loopback devices

Fri May 24 18:05:32 UTC 2013
Paul Heinlein <heinlein at madboa.com>

On Fri, 24 May 2013, Gelen James wrote:

> centos 6 failed to create entries under /dev for newly created loopback devices. Any one know why? and how to fix/workaround it?
>
> The steps to duplicate is pretty simple
>
> dd if=/dev/zero of=/tmp/deleteme bs=1M count=100
> losetup /dev/loop0 /tmp/deleteme
> fdisk /dev/loop0   ## created partitions 1, 2, etc.
> fdisk -l /dev/loop0  ## confirmed that the partitions do exist

At this point, you need to run "kpartx -a /dev/loop0" (fdisk should 
have told you so).

> mkfs.ext3 /dev/loop0p1 ## failed here [...]

kpartx drops partitions into /dev/mapper, so the actual invocation 
would be

   mkfs.ext3 /dev/mapper/loop0p1

You can also use partprobe instead of kpartx, but I'm not as familiar 
with its operation.

-- 
Paul Heinlein
heinlein at madboa.com
45°38' N, 122°6' W