diff options
author | Robert Schwebel <r.schwebel@pengutronix.de> | 2016-06-09 09:15:27 +0200 |
---|---|---|
committer | Robert Schwebel <r.schwebel@pengutronix.de> | 2016-06-10 14:32:28 +0200 |
commit | 6363815629a51cfc4b386fa53e2d94670bc968f0 (patch) | |
tree | 0002763d17e0230f9965d579899176412fcabfc4 /projectroot | |
parent | 4ca0c25096f3a3b6969d44f757500ede747406d6 (diff) | |
download | DistroKit-6363815629a51cfc4b386fa53e2d94670bc968f0.tar.gz DistroKit-6363815629a51cfc4b386fa53e2d94670bc968f0.tar.xz |
image: change partitioning, add data partition
We change the partitioning to have one root-A partition of 512 MB and a
data partition that fills up the rest of the boot medium.
The systemd-autoformat@.service formats the data partition if it isn't
already, and the 91-mkfs-ext4 rule automatically mounts it to /mnt/data.
Inspired-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
Diffstat (limited to 'projectroot')
-rw-r--r-- | projectroot/etc/fstab | 20 | ||||
-rw-r--r-- | projectroot/lib/systemd/system/systemd-autoformat@.service | 15 | ||||
-rw-r--r-- | projectroot/lib/udev/rules.d/91-mkfs-ext4.rules | 5 |
3 files changed, 40 insertions, 0 deletions
diff --git a/projectroot/etc/fstab b/projectroot/etc/fstab new file mode 100644 index 0000000..09b1d18 --- /dev/null +++ b/projectroot/etc/fstab @@ -0,0 +1,20 @@ +# +# /etc/fstab +# + +# special filesystems +proc /proc proc nosuid,nodev,noexec 0 0 +devpts /dev/pts devpts nosuid,noexec,mode=620,gid=112 0 0 +sysfs /sys sysfs nosuid,nodev,noexec 0 0 +debugfs /sys/kernel/debug debugfs noauto 0 0 + +# ramdisks +tmpfs /tmp tmpfs nosuid,nodev,mode=1777,size=20% 0 0 +tmpfs /run tmpfs nosuid,nodev,strictatime,mode=0755 0 0 +/run /var/run bind bind 0 0 +tmpfs /var/log tmpfs nosuid,nodev,noexec,mode=0755,size=10% 0 0 +tmpfs /var/lock tmpfs nosuid,nodev,noexec,mode=0755,size=1M 0 0 +tmpfs /var/tmp tmpfs nosuid,nodev,mode=1777,size=20% 0 0 + +# data partition +/dev/mmcblk0p3 /mnt/data ext4 defaults,x-systemd.automount 0 2 diff --git a/projectroot/lib/systemd/system/systemd-autoformat@.service b/projectroot/lib/systemd/system/systemd-autoformat@.service new file mode 100644 index 0000000..7522140 --- /dev/null +++ b/projectroot/lib/systemd/system/systemd-autoformat@.service @@ -0,0 +1,15 @@ +[Unit] +Before=mnt-data.mount systemd-fsck@%i.service +Description=Create ext4 Data Partition +ConditionPathExists=/dev/%i + +[Service] +Environment=DATAPARTITION=3 +Type=oneshot +# resize partition to maximum +ExecStart=/bin/sh -c 'echo ",+" | sfdisk --force -N$DATAPARTITION /dev/mmcblk0' +# force kernel to reload the partition size of partition 3 +ExecStart=/usr/sbin/partx -d -n $DATAPARTITION /dev/mmcblk0 +ExecStart=/usr/sbin/partx -a -n $DATAPARTITION /dev/mmcblk0 +# create filesystem (this service is only started if we have none) +ExecStart=/sbin/mkfs.ext4 /dev/%i diff --git a/projectroot/lib/udev/rules.d/91-mkfs-ext4.rules b/projectroot/lib/udev/rules.d/91-mkfs-ext4.rules new file mode 100644 index 0000000..1c1a396 --- /dev/null +++ b/projectroot/lib/udev/rules.d/91-mkfs-ext4.rules @@ -0,0 +1,5 @@ +ACTION!="add", GOTO="systemd-autoformat-ext4-devices_end" +SUBSYSTEM!="block", GOTO="systemd-autoformat-ext4-devices_end" +ENV{ID_FS_USAGE}!="filesystem", SUBSYSTEMS=="mmc", KERNEL=="mmcblk0p3", ENV{ID_FS_TYPE}!="ext4", ENV{SYSTEMD_WANTS}+="systemd-autoformat@$name.service" + +LABEL="systemd-autoformat-ext4-devices_end" |