[Ubuntu PA] Disk Imaging Solutions

Kevin Valentine kevin.valentine at gmail.com
Wed Jan 23 19:13:06 GMT 2008


OK, cloning the drives via a script is slowly coming together.  Now I'm
looking for support.  I have some Python skills but I'm sure there are
some/many/all on this list that surpass me.

Here's the coding challenge: make a script that creates/formats three
partitions on any selected hard drive.  For our DSL installations, this
is what we are looking for in a partition table:
/dev/hda1 = 64MB               linux-swap
/dev/hda2 = 60MB               ext2                    (DSL image)
/dev/hda3 = Rest of drive   ext2                    (user space)
NOTE: hda2 needs its boot flag enabled

To get a better idea of why this is needed, here's the physical process
for using the script(s) with the hard drives:
    1) pull a hard drive from the pile
    2) connect it to an USB-IDE adapter
    3) plug in USB and power up adapter
    4) wait for OS to detect partitions on drive
    5) run script that creates/formats partitions
    6) power cycle the drive (pull USB plug or toggle on/off switch)
    7) check if partition table gets read correctly
    8) run script that copies files to each partition
    9) run script that writes grub boot loader to MBR
    10) plug into any laptop and power it up!

The part that I need help with is line items 5 - 7.  For me, the ideal
solution is to do this with python so I can integrate it easily into
what I'm building.  But if you think you can do it with some other
scripting language (ruby, perl, tcl, etc), feel free to do it.  From my
searching around, I've found that using 'parted' is the most likely
solution.  After digging deeper I found that others have been in this
situation before.  There's a python module for parted called
python-parted.  What's strange is that there are two versions of it:
http://packages.ubuntu.com/edgy/python/python-parted
http://download.opensuse.org/repositories/devel:/languages:/python/openSUSE_10.2/repodata/repoview/python-parted-0-1.7.3-4.1.html

The first one seems like the best candidate.  I've installed it and
found it has a broken python dependency (had to force it).  Took a look
at the main python code, parted.py, and I don't know where to begin. 
Any takers?

-kevin



More information about the Ubuntu-us-pa mailing list