Changes between Version 16 and Version 17 of newport/ubuntu


Ignore:
Timestamp:
11/30/2018 08:45:51 PM (6 years ago)
Author:
Tim Harvey
Comment:

added a resize2fs_once script

Legend:

Unmodified
Added
Removed
Modified
  • newport/ubuntu

    v16 v17  
    219219}}}
    220220
     221For automatically resizing the rootfs on boot you can create a one-shot init script before you unmount the filesystem above:
     222{{{#!bash
     223cat << EOF > /etc/init.d/resize2fs_once
     224#!/bin/sh
     225### BEGIN INIT INFO
     226# Provides:          resize2fs_once
     227# Required-Start:
     228# Required-Stop:
     229# Default-Start: 2 3 4 5 S
     230# Default-Stop:
     231# Short-Description: Resize the root filesystem to fill partition
     232# Description:
     233### END INIT INFO
     234
     235. /lib/lsb/init-functions
     236
     237ROOT=\$(cat /proc/cmdline | sed -e 's/^.*root=//' -e 's/ .*\$//')
     238
     239case "\$1" in
     240  start)
     241    log_daemon_msg "Starting resize2fs_once" &&
     242    resize2fs \$ROOT &&
     243    rm /etc/init.d/resize2fs_once &&
     244    update-rc.d resize2fs_once remove &&
     245    log_end_msg \$?
     246    ;;
     247  *)
     248    echo "Usage: \$0 start" >&2
     249    exit 3
     250    ;;
     251esac
     252
     253EOF
     254chmod +x /etc/init.d/resize2fs_once
     255systemctl enable resize2fs_once
     256}}}
     257
     258
    221259[=#disk-images]
    222260== Building a Bootable Disk Images ==