Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.0:Ports
growpart
rootgrow
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File rootgrow of Package growpart
#!/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 )
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor