mkdosfs refuses to run on /dev/loop0p1
Bug #935480 reported by
Phillip Susi
This bug affects 2 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
dosfstools (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
psusi@faldara:~$ sudo mkdosfs /dev/loop0p1
mkdosfs 3.0.9 (31 Jan 2010)
mkdosfs: Device partition expected, not making filesystem on entire device '/dev/loop0p1' (use -I to override)
Obviously this is wrong since loop0p1 IS a partition. Oddly, it does not complain on loop0p2.
To post a comment you must log in.
This looks like the same bug we are seeing in GParted: https:/ /bugzilla. gnome.org/ show_bug. cgi?id= 693955
This is caused by an incorrect test in mkdosfs whether a device is a "hard disk":
if (fstat(dev, &statbuf) < 0) statbuf. st_mode) ) {
statbuf. st_rdev = 0;
( statbuf. st_rdev & 0xff0f) == 0x0800 || /* sd */
( statbuf. st_rdev & 0xff3f) == 0x0d00 || /* xd */
( statbuf. st_rdev & 0xff3f) == 0x1600) /* hdc, hdd */
die("unable to stat %s");
if (!S_ISBLK(
check = 0;
} else
/*
* Ignore any 'full' fixed disk devices, if -I is not given.
* On a MO-disk one doesn't need partitions. The filesytem can go
* directly to the whole disk. Under other OSes this is known as
* the 'superfloppy' format. As I don't know how to find out if
* this is a MO disk I introduce a -I (ignore) switch. -Joey
*/
if (!ignore_full_disk && ((statbuf.st_rdev & 0xff3f) == 0x0300 || /* hda, hdb */
)
die("Device partition expected, not making filesystem on entire device '%s' (use -I to override)");
It makes certain apparently incorrect assumptions about how raw device numbers for full disks vs. partitions look like.
(It also doesn't use major()/minor() on the raw device number, which looks not very portable or future-proof to me...)