Subject: bug#20893: Strange behavior when using parted

From: Joan Lledó <[email-masked]>
Date: Wed, 24 Jun 2015 22:44:23 +0200

Hello parted list,

I'm not sure this is a bug, probably not, but since I've installed
Debian 8 some scripts I use for helping me to test a library are
having a strange behavior. I've wrote a little script as an example:

#!/bin/bash
cd ~
modprobe scsi_debug dev_size_mb=800 sector_size=4096
parted /dev/sdf mklabel msdos
parted /dev/sdf mkpart primary 1 50
parted /dev/sdf mkpart primary 51 105
parted /dev/sdf mkpart extended 106 750
parted /dev/sdf mkpart primary 751 839
parted /dev/sdf mkpart logical 107 200
parted /dev/sdf mkpart logical 201 300
parted /dev/sdf mkpart logical 301 450
parted /dev/sdf mkpart logical 451 600
parted /dev/sdf mkpart logical 601 750

mkfs.ext4 /dev/sdf1
mkfs.vfat -F 32 /dev/sdf2
mkfs.ext2 /dev/sdf4
mkfs.ext3 /dev/sdf5
mkfs.vfat -F 16 /dev/sdf6
mkfs.ext4 /dev/sdf7
mkfs.vfat -F 32 /dev/sdf8
mkswap /dev/sdf9

xfs_admin -L selinux /dev/sdf8

echo "Mounting sdf1..."
mount /dev/sdf1 /mnt
umount /mnt

echo "Mounting sdf2..."
mount /dev/sdf2 /mnt
umount /mnt

echo "Mounting sdf4..."
mount /dev/sdf4 /mnt
umount /mnt

echo "Mounting sdf5..."
mount /dev/sdf5 /mnt
umount /mnt

echo "Mounting  sdf6..."
mount /dev/sdf6 /mnt
umount /mnt

echo "Mounting sdf7..."
mount /dev/sdf7 /mnt
umount /mnt

echo "Mounting sdf8..."
mount /dev/sdf8 /mnt
umount /mnt

When I run this script, most of the attempts to format the new
partitions fail with the error "The file /dev/sdf1 does not exist and
no size was specified.", just like the attempts to mount the formatted
partitions. The result of running this script is not even always the
same. Is seems like the kernel is not receiving the updates of the
/dev/sdf device. Not sure if this is caused by parted, udev, the
kernel... any ideas?