pyparted icon indicating copy to clipboard operation
pyparted copied to clipboard

unable to use getPedDevice() with a loop device

Open Lunarequest opened this issue 3 years ago • 3 comments

If I use a loop device as the disk when getPedDevice(), for example running the following code reliably has issues.


# Create a disk image then attach it to a loopback device (e.g. /dev/loop0)
'''
dd if=/dev/zero of=disk.img bs=512 count=2097152
losetup -f disk.img
kpartx -a /dev/loop0
'''

device = '/dev/loop0'
loop0 = parted.getDevice(device)
loop0.clobber()  # destroy existing partition table
disk = parted.newDisk(loop0)

the following error is raised

    peddisk = disk_new(device.getPedDevice())
_ped.DiskException: /dev/loop0: unrecognised disk label

is there a way I can work around this on my end?

Lunarequest avatar Mar 02 '21 06:03 Lunarequest

I can recreate this issue with the git branch aswell

Lunarequest avatar Mar 02 '21 06:03 Lunarequest

Any updates on this issue?

svartkanin avatar Jul 12 '23 11:07 svartkanin

nope

Lunarequest avatar Jul 12 '23 11:07 Lunarequest