how to determine if files are on same or different file systems

Jeff Epler jepler at
Mon Dec 8 04:35:27 CET 2003

You can find the device a file is on using the .st_dev field of its stat
	>>> os.stat("/").st_dev
see the stat manpage for more details.

You can find the magic number for a particular filesystem using statfs(2),
but as far as I can tell this is not exposed in Python.  If it were,
you'd write something like
	>>> os.statfs("/").f_type
to get the type of the filesystem where / resides.  Some f_type values
are mentioned in my statfs(2) manpage, including 
	NFS_SUPER_MAGIC       0x6969
os.statvfs() seems to be unrelated, though my system lacks a manpage for


More information about the Python-list mailing list