Re: detecting drives for windows and linux



aleaxit@xxxxxxxxx (Alex Martelli) wrote:

Max <rabkin@mweb[DOT]co[DOT]za> wrote:

BWill wrote:

oh, I wasn't expecting a single solution for both platforms, just some
good solutions

thanks

Are you aware that this idea is somewhat foreign to Linux? (Maybe you
are and want to do it anyway?) Linux puts the whole file system
(including mounted iPods, ISOs and NTFS drives) in one hierarchy.

Yes, but you may still want to distinguish (because, for example, hard
linking doesn't work across filesystems, and mv is not atomic then).

Why not use os.stat?


Running a df command is a good simple way to find out what drives are
mounted to what mountpoints -- the mount command is an alternative, but
its output may be slightly harder to parse than df's.

Executing df may be expensive if it needs to read some slow file systems.
Reading /etc/mtab is not difficult and much faster.


Florian
--
Das toitsche Usenet ist die Wiederaufführung des Dreißigjährigen Krieges mit
den Mitteln einer Talkshow. [Alexander Bartolich in dcpu]
.



Relevant Pages

  • Linux Frequently Asked Questions with Answers (Part 3 of 6)
    ... under the 1024 logical cylinder limit, and boot from that. ... Undelete functionality for the ext2fs file system ... How To Resize a Partition. ... Use the FIPS.EXE program, included with most Linux distributions,under ...
    (comp.os.linux.misc)
  • Linux Frequently Asked Questions with Answers (Part 3 of 6)
    ... under the 1024 logical cylinder limit, and boot from that. ... Undelete functionality for the ext2fs file system ... How To Resize a Partition. ... Use the FIPS.EXE program, included with most Linux distributions,under ...
    (comp.os.linux.misc)
  • Linux Frequently Asked Questions with Answers (Part 3 of 6)
    ... under the 1024 logical cylinder limit, and boot from that. ... Undelete functionality for the ext2fs file system ... How To Resize a Partition. ... Use the FIPS.EXE program, included with most Linux distributions,under ...
    (comp.os.linux.misc)
  • Linux Frequently Asked Questions with Answers (Part 3 of 6)
    ... under the 1024 logical cylinder limit, and boot from that. ... Undelete functionality for the ext2fs file system ... How To Resize a Partition. ... Use the FIPS.EXE program, included with most Linux distributions,under ...
    (comp.os.linux.misc)
  • Linux Frequently Asked Questions with Answers (Part 3 of 6)
    ... under the 1024 logical cylinder limit, and boot from that. ... Undelete functionality for the ext2fs file system ... How To Resize a Partition. ... Use the FIPS.EXE program, included with most Linux distributions,under ...
    (comp.os.linux.misc)