Browse Source

MEN-3172: [rpi3] Fill all available space on the memory card

This commit adds a systemd script which on boot runs parted to fill the
remaining space on the memory card into the data partition.

Changelog: None

Signed-off-by: Ole Petter <ole.orhagen@northern.tech>
2.1.x
Ole Petter 5 years ago
parent
commit
db59222de1
No known key found for this signature in database GPG Key ID: A7100375167A7B21
  1. 34
      configs/images/raspberrypi3_raspbian_config

34
configs/images/raspberrypi3_raspbian_config

@ -12,3 +12,37 @@ IMAGE_OVERHEAD_FACTOR=1.0
# Best compression there is!
MENDER_COMPRESS_DISK_IMAGE=lzma
#
# Resize the data partition to fill the remaining space, using parted, with systemd
#
function grow_data_partition() {
log_info "Adding systemd init script to run parted and resize the data partition on boot"
log_info "to fill all the available space on the storage media"
run_and_log_cmd "sudo mkdir -p work/rpi/etc/systemd/system/"
run_and_log_cmd "sudo mkdir -p work/rootfs/etc/systemd/system/data.mount.wants/"
cat <<-EOF > work/rpi/etc/systemd/system/mender-grow-data.service
[Unit]
Description=Mender service to grow data partition size
DefaultDependencies=no
Before=data.mount
Before=systemd-growfs@data.service
[Service]
Type=oneshot
User=root
Group=root
ExecStart=/sbin/parted --script /dev/mmcblk0 resizepart ${MENDER_DATA_PART_NUMBER} 100%
[Install]
WantedBy=data.mount
EOF
# Install
run_and_log_cmd "cp work/rpi/etc/systemd/system/mender-grow-data.service \
work/rootfs/etc/systemd/system/"
run_and_log_cmd "ln -sf work/rootfs/etc/systemd/system/mender-grow-data.service \
work/rootfs/etc/systemd/system/data.mount.wants/"
}
PLATFORM_MODIFY_HOOKS+=(grow_data_partition)

Loading…
Cancel
Save