views:

108

answers:

2

Hi,

I'm looking for some sort of partition management library (preferably a Python one, but anything works) that will function on both Windows and Linux. (For working with USB devices, specifically, but any harddisk tool should do)

We'd much rather not implement two different libraries as that makes it harder to maintain, but so far we have not found anything that provides cross-platform compatibility in this regard.

This is for users partitioning a USB flash memory stick (I should have put that in the question), and we're expecting that they won't know how to partition it, let alone in our way. Our specific case is setting up a USB flash drive with a EXT3 filesystem made in a special way (so as to be USB_ZIP compatible)

A: 

As partitioning is a risky business hardly done except when installing an OS, I wonder why you would want to do that from inside your application via a library.

Why don't you just call the available partitioning application appropriate for the OS via e.g. the system() call? This way you will ensure that the user gets presented a UI that he is familiar with (assuming he did at least once partition anything).

lothar
Well, this is for users partitioning a USB flash memory stick (I should have put that in the question), and we're expecting that they won't know how to partition it, let alone in *our* way.Our specific case is setting up a USB flash drive with a EXT3 filesystem made in a special way (so as to be USB_ZIP compatible).
lfaraone
Make sure to add those details to your question. Not everybody reads comments ;-)
lothar
+1  A: 

You can either use libparted from GNU parted (http://www.gnu.org/software/parted/index.shtml) or open a pipe to sfdisk which is the most scriptable of the partitioning tools on most linux distros.