From add478b5ab17663702c27c2e4f37a5528ce065fc Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Wed, 19 Jan 2011 17:11:40 +0100 Subject: [PATCH] lvmstrap: ignore small-sized partitions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch changes lvmstrap to ignore βsmallβ partitions. Currently extended partitions are reported as unused as with a size of 1024 (bytes), and this confuses lvmstrap. Since a very small partition won't help anyway (below hundred of PE size is not helpful), let's restrict it to 1GB. Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Michael Hanselmann <hansmi@google.com> --- tools/lvmstrap | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/lvmstrap b/tools/lvmstrap index 7f6d34410..98a8856d0 100755 --- a/tools/lvmstrap +++ b/tools/lvmstrap @@ -78,6 +78,9 @@ EXCLUDED_FS = frozenset([ "devpts", ]) +#: Minimum partition size to be considered (1 GB) +PART_MINSIZE = 1024 * 1024 * 1024 + class Error(Exception): """Generic exception""" @@ -446,8 +449,9 @@ def GetDiskList(opts): continue partdev = ReadDev("/sys/block/%s/%s" % (name, partname)) partsize = ReadSize("/sys/block/%s/%s" % (name, partname)) - CheckSysDev(partname, partdev) - partitions.append((partname, partsize, partdev)) + if partsize >= PART_MINSIZE: + CheckSysDev(partname, partdev) + partitions.append((partname, partsize, partdev)) partitions.sort() dlist.append((name, size, dev, partitions, inuse)) dlist.sort() -- GitLab