forked from pool/growpart
- Update to version 0.30 (bsc#1064755)
+ improved error messages on failure. + ignore sfdisk failure in 2.28.1 when due to reread failing (LP: #1619285) + Add service file to start growpart via systemd + Add rootgrow script to wrap growpart OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/growpart?expand=0&rev=7
This commit is contained in:
parent
739b3f2e99
commit
b71ffcb776
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:9ea1b66f5a4798c8d6eeca48d908e11169a38e943efa433b7ec5dffa907e257c
|
||||
size 419396
|
BIN
cloud-utils-0.30.tar.gz
(Stored with Git LFS)
Normal file
BIN
cloud-utils-0.30.tar.gz
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -1,3 +1,13 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Jan 22 21:12:33 UTC 2018 - rjschwei@suse.com
|
||||
|
||||
- Update to version 0.30 (bsc#1064755)
|
||||
+ improved error messages on failure.
|
||||
+ ignore sfdisk failure in 2.28.1 when due to reread failing
|
||||
(LP: #1619285)
|
||||
+ Add service file to start growpart via systemd
|
||||
+ Add rootgrow script to wrap growpart
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Sep 13 20:53:26 UTC 2016 - rjschwei@suse.com
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package growpart
|
||||
#
|
||||
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -17,17 +17,24 @@
|
||||
|
||||
|
||||
Name: growpart
|
||||
Version: 0.29
|
||||
Version: 0.30
|
||||
Release: 0
|
||||
Summary: Grow a partition
|
||||
License: GPL-3.0
|
||||
Group: System/Management
|
||||
Url: http://launchpad.net/cloud-utils
|
||||
Source0: cloud-utils-%{version}.tar.gz
|
||||
Source1: rootgrow
|
||||
Source2: rootgrow.service
|
||||
Patch: licenseGPLv3.patch
|
||||
Requires: util-linux
|
||||
%if 0%{?suse_version} && 0%{?suse_version} >= 1220
|
||||
%if 0%{?suse_version} && 0%{?suse_version} > 1220
|
||||
Requires: gptfdisk
|
||||
Requires: python3
|
||||
Requires: systemd
|
||||
# pkg-config is needed to find correct systemd unit dir
|
||||
BuildRequires: pkg-config
|
||||
BuildRequires: systemd
|
||||
%endif
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
BuildArch: noarch
|
||||
@ -44,10 +51,15 @@ partition can be expanded to take up the additional size.
|
||||
%build
|
||||
|
||||
%install
|
||||
mkdir -p %{buildroot}/%{_sbindir}
|
||||
mkdir -p %{buildroot}/%{_mandir}/man1
|
||||
mkdir -p %{buildroot}/%{_sbindir}
|
||||
cp bin/growpart %{buildroot}/%{_sbindir}
|
||||
cp man/growpart.1 %{buildroot}/%{_mandir}/man1
|
||||
%if 0%{?suse_version} && 0%{?suse_version} > 1220
|
||||
mkdir -p %{buildroot}/usr/lib/systemd/system
|
||||
cp %SOURCE1 %{buildroot}/%{_sbindir}
|
||||
cp %SOURCE2 %{buildroot}/usr/lib/systemd/system
|
||||
%endif
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
@ -57,5 +69,9 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%doc LICENSE-GPLv3
|
||||
%{_sbindir}/growpart
|
||||
%{_mandir}/man1/*
|
||||
%if 0%{?suse_version} && 0%{?suse_version} > 1220
|
||||
%{_sbindir}/rootgrow
|
||||
/usr/lib/systemd/system/rootgrow.service
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
|
57
rootgrow
Normal file
57
rootgrow
Normal file
@ -0,0 +1,57 @@
|
||||
#!/usr/bin/python3
|
||||
import os
|
||||
import re
|
||||
import syslog
|
||||
|
||||
split_dev = re.compile('([a-z/]*)(\d*)')
|
||||
mounts = open('/proc/mounts' ,'r').readlines()
|
||||
|
||||
def get_mount_point(device):
|
||||
for mount in mounts:
|
||||
if mount.startswith(device):
|
||||
return mount.split(' ')[1]
|
||||
|
||||
def resize_fs(fs_type, device):
|
||||
if fs_type.startswith('ext'):
|
||||
cmd = 'resize2fs %s' % device
|
||||
syslog.syslog(
|
||||
syslog.LOG_INFO,
|
||||
'Resizing: "%s"' %cmd
|
||||
)
|
||||
os.system(cmd)
|
||||
elif fs_type == 'xfs':
|
||||
mnt_point = get_mount_point(device)
|
||||
cmd = 'xfs_growfs %s' % mnt_point
|
||||
syslog.syslog(
|
||||
syslog.LOG_INFO,
|
||||
'Resizing: "%s"' %cmd
|
||||
)
|
||||
os.system(cmd)
|
||||
|
||||
|
||||
for mount in mounts:
|
||||
if ' / ' in mount:
|
||||
mount_dev = mount.split(' ')[0]
|
||||
fs = mount.split(' ')[2]
|
||||
try:
|
||||
dev, partition = split_dev.match(mount_dev).groups()
|
||||
except:
|
||||
syslog.syslog(
|
||||
syslog.LOG_ERR,
|
||||
'match exception for "%s"' % mount
|
||||
)
|
||||
break
|
||||
if dev and partition:
|
||||
cmd = '/usr/sbin/growpart %s %s' %(dev, partition)
|
||||
syslog.syslog(
|
||||
syslog.LOG_INFO,
|
||||
'Executing: "%s"' % cmd
|
||||
)
|
||||
os.system(cmd)
|
||||
resize_fs(fs, mount_dev)
|
||||
else:
|
||||
syslog.syslog(
|
||||
syslog.LOG_ERR,
|
||||
'could not match device and partition in "%s"' % mount
|
||||
)
|
||||
|
11
rootgrow.service
Normal file
11
rootgrow.service
Normal file
@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=Grow the root partition
|
||||
After=local-fs.target
|
||||
Wants=local-fs.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/sbin/rootgrow
|
||||
Type=oneshot
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Loading…
Reference in New Issue
Block a user