diff -up parted-1.9.0/libparted/arch/linux.c.orig parted-1.9.0/libparted/arch/linux.c --- parted-1.9.0/libparted/arch/linux.c.orig 2009-12-14 22:44:18.000000000 +0100 +++ parted-1.9.0/libparted/arch/linux.c 2009-12-15 10:25:38.000000000 +0100 @@ -259,6 +259,7 @@ struct blkdev_ioctl_param { #define SX8_MAJOR2 161 #define XVD_MAJOR 202 #define SDMMC_MAJOR 179 +#define LOOP_MAJOR 7 #define SCSI_BLK_MAJOR(M) ( \ (M) == SCSI_DISK0_MAJOR \ @@ -561,6 +562,8 @@ _device_probe_type (PedDevice* dev) dev->type = PED_DEVICE_SDMMC; } else if (_is_virtblk_major(dev_major)) { dev->type = PED_DEVICE_VIRTBLK; + } else if (dev_major == LOOP_MAJOR) { + dev->type = PED_DEVICE_FILE; } else { dev->type = PED_DEVICE_UNKNOWN; } @@ -1048,6 +1048,15 @@ init_file (PedDevice* dev) if (!ped_device_open (dev)) goto error; + dev->sector_size = PED_SECTOR_SIZE_DEFAULT; + char *p = getenv ("PARTED_SECTOR_SIZE"); + if (p) { + int s = atoi (p); + if (0 < s && s % 512 == 0) + dev->sector_size = s; + } + dev->phys_sector_size = dev->sector_size; + if (S_ISBLK(dev_stat.st_mode)) dev->length = _device_get_length (dev); else