-
Notifications
You must be signed in to change notification settings - Fork 44
Description
Hi David,
We just stumbled onto a rather quirky issue involving USB a card "reader" with removable Flash-based media. It's easily reproduced with two completely different hardware models (Transcend RDP8 and Lexar Workflow series). Basically parted is not showing any change in geometry when we change cards from one size to another, even though a new instance is gotten each time. Whether the issue is in pyparted or parted itself, I don't know.
Here's the trivial test case:
import parted
while True:
print('press Enter after inserting a new card and letting things settle')
input()
dev = parted.getDevice('/dev/sdh')
print(dev)Here's example output where I start with a 2 GB CF card, press Enter, replace with a 16 GB CF card (in the same reader slot), wait a few seconds and press Enter again. I then break out of the script and restart it and press Enter without touching the card this 3rd time. Oddly the change in capacity is only recognized after restarting. Whatsupwithdat?
$ sudo python3 /tmp/huh.py
press Enter after inserting a new card and letting things settleparted.Device instance --
model: Lexar WorkflowCFR1 path: /dev/sdc type: 1
sectorSize: 512 physicalSectorSize: 512
length: 3915072 openCount: 0 readOnly: False
externalMode: False dirty: False bootDirty: False
host: 0 did: 0 busy: False
hardwareGeometry: (7676, 255, 2) biosGeometry: (7676, 255, 2)
PedDevice: <_ped.Device object at 0x7f4739af3f28>
press Enter after inserting a new card and letting things settleparted.Device instance --
model: Lexar WorkflowCFR1 path: /dev/sdc type: 1
sectorSize: 512 physicalSectorSize: 512
length: 3915072 openCount: 0 readOnly: False
externalMode: False dirty: False bootDirty: False
host: 0 did: 0 busy: False
hardwareGeometry: (7676, 255, 2) biosGeometry: (7676, 255, 2)
PedDevice: <_ped.Device object at 0x7f472ee46268>
press Enter after inserting a new card and letting things settle
^CTraceback (most recent call last):
File "/tmp/wtf.py", line 4, in
input()
KeyboardInterrupt
$ sudo python3 /tmp/huh.py
press Enter after inserting a new card and letting things settleparted.Device instance --
model: Lexar WorkflowCFR1 path: /dev/sdc type: 1
sectorSize: 512 physicalSectorSize: 512
length: 31293360 openCount: 0 readOnly: False
externalMode: False dirty: False bootDirty: False
host: 0 did: 0 busy: False
hardwareGeometry: (61359, 255, 2) biosGeometry: (61359, 255, 2)
PedDevice: <_ped.Device object at 0x7f8ae6d46f28>
press Enter after inserting a new card and letting things settle