From bd57de1982720739b66abea1e312946aea94be05 Mon Sep 17 00:00:00 2001 From: Mike Fulbright Date: Fri, 16 Aug 2002 05:05:54 +0000 Subject: simple script to scan and list harddrives for use in kickstart --- command-stubs/list-harddrives-stub | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 command-stubs/list-harddrives-stub (limited to 'command-stubs') diff --git a/command-stubs/list-harddrives-stub b/command-stubs/list-harddrives-stub new file mode 100755 index 000000000..cd53689f7 --- /dev/null +++ b/command-stubs/list-harddrives-stub @@ -0,0 +1,37 @@ +#!/usr/bin/python +# +# scan system for harddrives and output device name/size +# + +import parted +import partedUtils +import isys +import os + +drives = isys.hardDriveDict() + +driveList = drives.keys() +driveList.sort() +for drive in driveList: + + if isys.driveIsRemovable(drive): + continue + + # try to open and get size + skip = 0 + deviceFile = "/tmp/%s" % (drive,) + isys.makeDevInode(drive, deviceFile) + try: + dev = parted.PedDevice.get(deviceFile) + except: + skip = 1 + os.remove(deviceFile) + + if skip: + continue + + sizeMB = (float(dev.heads * dev.cylinders * dev.sectors) / (1024 * 1024) + * dev.sector_size) + + print drive, sizeMB + -- cgit