Created
August 13, 2015 16:17
-
-
Save shadeslayer/ebdf8435b586e8247829 to your computer and use it in GitHub Desktop.
Resize things
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
# | |
# === This file is part of Calamares - <http://github.com/calamares> === | |
# | |
# Copyright 2015, Rohan Garg <[email protected]> | |
# | |
# Calamares is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# | |
# Calamares is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
# GNU General Public License for more details. | |
# | |
# You should have received a copy of the GNU General Public License | |
# along with Calamares. If not, see <http://www.gnu.org/licenses/>. | |
import os | |
import re | |
import libcalamares | |
import parted | |
def run(): | |
""" Resizes the rootfs partition. | |
:return: | |
""" | |
device = parted.Device('/dev/mmcblk0') | |
disk = parted.Disk(device) | |
rootfs = disk.partitions[1] | |
constraint = device.optimalAlignedConstraint | |
new_end_ext = rootfs.getMaxGeometry(constraint).end | |
disk.setPartitionGeometry(partition=rootfs, constraint=constraint, start=rootfs.geometry.start, end=new_end_ext) | |
disk.commit() | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment