[parted-devel] [PATCH 9/9] libparted: device mapper uses 512b sectors

Brian C. Lane bcl at redhat.com
Fri Feb 6 21:42:47 UTC 2015


On Fri, Feb 06, 2015 at 02:12:02PM -0500, Phillip Susi wrote:
> On 2/6/2015 12:50 PM, Brian C. Lane wrote:
> > On Fri, Feb 06, 2015 at 11:33:21AM -0500, Phillip Susi wrote:
> >> On 2/6/2015 11:24 AM, Brian C. Lane wrote:
> >>> We tell device-mapper the size of the disk and the partitions, 
> >>> right now we are using native disk sector units for this. We
> >>> need to make sure we use 512b units when talking to
> >>> device-mapper.
> >> 
> >> Yes, but the "native disk sector units" are always 512 bytes
> >> since that is what devmapper tells us it is.  We have no idea
> >> that there is a 4k sector disk underneath devmapper.
> > 
> > That's not true. Take a look at the test, it demonstrates the
> > problem.
> 
> It is at least true under normal circumstances... iirc though, the
> test harness uses PED_SECTOR_SIZE to force parted to ignore the size
> the disk reports and pretend it has a larger sector size.  Is that
> what is going on here?  If so then then problem is only with the test
> harness and I'm not entirely sure using that override that way is
> really supported.  In other words, this kind of feels like a "don't do
> that" bug.  On the other hand, I suppose it wouldn't *hurt* to fix it.

That's probably also happening, but I can reproduce it outside of the
test harness:

modprobe scsi_debug sector_size=1024 dev_size_mb=500
scsi_dev=/dev/sdb
scsi_dev_size=$(blockdev --getsz $scsi_dev)
dmsetup create dmtest --table "0 $scsi_dev_size linear $scsi_dev 0"
dev="/dev/mapper/dmtest"
parted -s $dev u s p free
Error: /dev/mapper/dmtest: unrecognised disk label
Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/dmtest: 512000s
Sector size (logical/physical): 1024B/1024B
Partition Table: unknown
Disk Flags: 

We also have reports of this happening on multipath setups with 4k disks.

--
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)



More information about the parted-devel mailing list