fdisk & mount don't agree

After much moving of partitions (via gpartd) and installation of various OS’s, I’ve got a bit of a problem: fdisk and mount don’t agree about which partition corresponds to which device:

wonder:~ # fdisk -l

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x43764c23

Device Boot Start End Blocks Id System
/dev/sda1 * 1 1782 14313883+ 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 1783 2189 3269227+ 82 Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/sda3 2190 19457 138705210 7 HPFS/NTFS
Partition 3 does not end on cylinder boundary.

But notice the disagreement with mount:

wonder:~ # mount
/dev/sda3 on / type ext3 (rw,acl,user_xattr)

How can I fix this?

I’m not an expert on this stuff but the “cylinder boundary” comments look ominous to me, or at least very unusual. Maybe NTFS shouldn’t have been manipulated with Gparted especially if it was a vista partition. Where did the NTFS partition come from?

In the meantime others should jump in with advice, because this is not a strong area of mine.

mount reads from a textfile, /etc/mtab, which may not be in sync with the kernel fs table from /proc/filesystems.

It does look scary, but I’ve seen it many times over the years, and I vaguely remember reading that it’s not a big deal.

The NTFS partition is a XP install from scratch. gparted claims to work with NTFS and it did: I stretched and moved that partition a number of times and Windows works well still

Right, you mean /proc/mounts:

wonder:~ # cat /proc/mounts
rootfs / rootfs rw 0 0
udev /dev tmpfs rw,mode=755 0 0
/dev/sda1 / ext3 rw,errors=continue,user_xattr,acl,barrier=1,data=ordered 0 0
proc /proc proc rw 0 0
sysfs /sys sysfs rw 0 0
debugfs /sys/kernel/debug debugfs rw 0 0
devpts /dev/pts devpts rw,gid=5,mode=620 0 0
fusectl /sys/fs/fuse/connections fusectl rw 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0

But how do I get them in sync?

fdisk (and /proc/partitions) shows what partitions are there, /proc/mounts (and mtab) only those that are mounted. There is no way to get that in sync because they are two different things. Some partitions may not even be mountable (like swap).


As far as the cylinder boundaries, don’t worry about it unless you are actually have a disk I/O problem. My memory is sketchy on this, but as I recall back in DOS land this was a consideration; DOS wrote and used start/end locations to the partition table. Later Windows began using only the start position, as does Linux. All that matters is that it can accurately find the first sector of each partition.

And re the partition being flagged as NTFS, I suspect that partition was originally created by W2K/XP. Windows does rigidly use certain fields in the table like partition type, but Linux doesn’t. A Linux format will write to the field, but what the kernel cares about is the filesystem actually on the partition and how it is mounted. So if you have ext3 formatted on that partition and are mounting it accordingly, Linux doesn’t care what the type code is.

The partition table can be edited by hand - but you don’t want to go there unless it is absolutely necessary.