From 5b39667492a46c19c6de602775ee73ce95449678 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Mon, 12 Jul 2004 19:26:01 +0000 Subject: sniff for raid and lvm magic before ext[23]. if you have ext[23] on raid, then the magic is going to (potentially) be on the component devs. add sniffing for lvm2 magic based on code in the lvm tools --- partedUtils.py | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/partedUtils.py b/partedUtils.py index 652790be0..466f69b09 100644 --- a/partedUtils.py +++ b/partedUtils.py @@ -398,6 +398,23 @@ def sniffFilesystemType(device): pass return None + # physical volumes start with HM (see linux/lvm.h + # and LVM/ver/tools/lib/pv_copy.c) + if buf.startswith("HM"): + return "physical volume (LVM)" + # sniff for LVM2 label. see LVM/ver/lib/label/label.[ch] for a + # description of the label and LVM/ver/lib/format_text/layout.h + for sec in range(0, 4): + off = (sec * 512) + 24 + if buf[off:].startswith("LVM2"): + return "physical volume (LVM)" + + try: + isys.raidsbFromDevice(dev) + return "software RAID" + except: + pass + # ext2 check if struct.unpack("