[parted-devel] [PATCH 0/3 v2] Support for partitions on loop devices

Karel Zak kzak at redhat.com
Tue Oct 4 09:25:05 UTC 2011


On Fri, Sep 30, 2011 at 11:25:19AM +0200, Jim Meyering wrote:
> Petr Uzel wrote:
> Hmm... it even fails on rawhide (in a VM)
> with this kernel:
> 
>   3.1.0-0.rc8.git0.0.fc17.x86_64

 Do you have loop devices support in module? 
 
 If I good remember Fedora doesn't use module for loops, so
 partitioned loop devices are not supported there. 
 
 This should be improved in kernel 3.2 where (I hope) will be a new
 LO_FLAGS_PARTSCAN flag for loopdevs.
 

> I.e., running this:
> 
>     sudo make check -C tests TESTS=t8001-loop-blkpg.sh VERBOSE=yes
> 
> I get this in tests/t8001-loop-blkpg.sh.log:
> 
> + lsmod
> + grep '^loop[[:space:]]'
> + modprobe loop max_part=7
> + dd if=/dev/zero of=backing_file bs=1M count=4
> ++ losetup -f --show backing_file

 Suggestion, don't use loop devices if you want to work with
 partitioned block devices. It's better to use scsi_debug module which
 is able to emulate block devices with arbitrary topology and without
 any restriction for partitioning tools.

 something like:

  modprobe scsi_debug dev_size_mb=10

  DEVNAME=$(grep scsi_debug /sys/block/*/device/model | awk -F '/' '{print $4}')
  DEVICE="/dev/${DEVNAME}"

  parted -s DEVNAME mklabel msdos


    Karel


> + loopdev=/dev/loop0
> + test -z /dev/loop0
> + parted -s /dev/loop0 mklabel msdos
> + compare err /dev/null
> + diff -u err /dev/null
> + parted -s /dev/loop0 mkpart primary 1M 2M
> + compare /dev/null err
> + diff -u /dev/null err
> + udevadm settle --timeout=5
> ++ basename /dev/loop0p1
> + entry=loop0p1
> + grep loop0p1 /proc/partitions
> + cat /proc/partitions
> major minor  #blocks  name
> 
>    7        0       4096 loop0
>  252        0   10485760 vda
>  252        1     512000 vda1
>  252        2    8743936 vda2
>  252        3    1228800 vda3
> + fail=1
> + parted -s /dev/loop0 rm 1
> + compare /dev/null err
> + diff -u /dev/null err
> + udevadm settle --timeout=5
> + grep loop0p1 /proc/partitions
> + Exit 1
> 
> Maybe we have different kernel patches?
> I can't investigate now: no more time for parted today.
> 
> >> If you ACK what I've included below, I'll push these three commits.
> >
> > ACKed. Thanks!
> 
> Pushed.
> 
> _______________________________________________
> parted-devel mailing list
> parted-devel at lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/parted-devel
> 

-- 
 Karel Zak  <kzak at redhat.com>
 http://karelzak.blogspot.com



More information about the parted-devel mailing list