Ubuntu Pastebin

Paste from ogra at Fri, 8 Sep 2017 11:18:46 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
if [ "$min_free_space" -lt "$free_space" ]; then
    echo "initrd: found more than 10% free space on disk, resizing ${writable_part}" >/dev/kmsg || true
    echo "initrd: partition to full disk size, see ${LOGFILE} for details" >/dev/kmsg || true
    # back up the original partition table for later use or debugging
    parted -ms "$device" unit B print >$TMPFILE 2>/dev/null
    # grow our selected partition to max space available
    table="$(parted -ms "$device" print| grep ^/| cut -d: -f6)"
    case $table in
        gpt)
            # do_gpt needs the device name
            do_gpt "$device" >>$LOGFILE 2>&1
            ;;
        mbr|msdos)
            # do_mbr needs the device node and partition number
            do_mbr "$device" "$partition" >>$LOGFILE 2>&1
            resizeopts="-f"
            ;;
        *)
            echo "unknown partition table type, not resizing" >>$LOGFILE
            exit 0
            ;;
    esac
    # make sure the partitions are ready for further use
    udevadm settle >>$LOGFILE 2>&1
    # check the filesystem before attempting re-size
    e2fsck -fy "$writable_part" >>$LOGFILE 2>&1
    # resize the filesystem to full size of the partition
    resize2fs "$resizeopts" "$writable_part" >>$LOGFILE 2>&1
fi
Download as text