fdisk problems with 2.2.x ?

Matija Nalis (mnalis@jagor.srce.hr)
3 May 1999 09:40:25 GMT


I'm running 2.2.7, but this has been there for few older versions also.
I can't write partition table to disk.

when I try to remove partition /dev/hda12 (which is not mounted or used in
any way) (like, 'd', '12', 'w') I get next message:

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
Re-read table failed with error 16: Device or resource busy.
Reboot your system to ensure the partition table is updated.

strace reveals:
sync() = 0
nanosleep(0xbffff618, 0xbffff618, 0x400a86cc, 0, 0x8048d50) = 0
ioctl(3, BLKRRPART, 0x2) = -1 EBUSY (Device or resource busy)
close(3) = 0

It's standard new IDE HDD driver... Looking into source (if I got correct
one), it says:

if (drive->busy || (drive->usage > 1)) {
spin_unlock_irqrestore(&hwgroup->spinlock, flags);
return -EBUSY;
};

but there I stopped. I have no expirience with ide_drive_t structure, but it
says that busy is 'currently doing revalidate_disk' and that usage is
'current "open()" count for drive'. Well, I can easily see how open() count
for drive could be much bigger than '1', if we are talking about whole
/dev/hda, and not /dev/hda12.

But I distinctly remember that I was able to change partition table of drive
which has few mounted filesystems (at least add new partitions). Or have I
totally gone mad ?

/proc/mounts says:

/dev/root / ext2 rw 0 0
/proc /proc proc rw 0 0
/dev/hda2 /boot ext2 rw 0 0
/dev/sda1 /usr ext2 ro 0 0
/dev/sda3 /var ext2 rw 0 0
/dev/hda6 /back umsdos rw 0 0
/dev/hda5 /dos msdos rw 0 0
/dev/hda7 /oldslack ext2 ro 0 0
/dev/hda10 /varmin ext2 rw 0 0

/proc/swaps says:
Filename Type Size Used Priority
/dev/hda9 partition 96352 1320 -1
/dev/sda2 partition 34964 0 -2
/dev/hda11 partition 104384 0 -3

My partition table output is:

Disk /dev/hda: 255 heads, 63 sectors, 790 cylinders
Units = cylinders of 16065 * 512 bytes

Device Boot Start End Blocks Id System
/dev/hda1 1 3 24066 4 DOS 16-bit <32M
/dev/hda2 * 4 7 32130 83 Linux native
/dev/hda3 8 790 6289447+ 5 Extended
/dev/hda5 8 73 530113+ 6 DOS 16-bit >=32M
/dev/hda6 74 316 1951866 6 DOS 16-bit >=32M
/dev/hda7 317 559 1951866 83 Linux native
/dev/hda8 560 585 208813+ 83 Linux native
/dev/hda9 586 597 96358+ 82 Linux swap
/dev/hda10 598 626 232911 83 Linux native
/dev/hda11 627 639 104391 82 Linux swap
/dev/hda12 640 790 1212876 83 Linux native

Disk /dev/hdc: 64 heads, 63 sectors, 619 cylinders
Units = cylinders of 4032 * 512 bytes

Device Boot Start End Blocks Id System
/dev/hdc1 * 1 618 1245856+ 6 DOS 16-bit >=32M

Disk /dev/sda: 141 heads, 62 sectors, 1020 cylinders
Units = cylinders of 8742 * 512 bytes

Device Boot Start End Blocks Id System
/dev/sda1 1 375 1639094 83 Linux native
/dev/sda2 376 383 34968 82 Linux swap
/dev/sda3 384 1020 2784327 83 Linux native

-- 
Opinions above are GNU-copylefted.

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/