Skip to content

Commit

Permalink
Merge pull request #1 from Physarah/switch_fix
Browse files Browse the repository at this point in the history
possible fix
  • Loading branch information
Physarah authored Jun 15, 2021
2 parents b35bde3 + 5fae3f5 commit ea40ce6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 3 additions & 2 deletions data/setssdroot.service
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
Description=Change rootfs to SSD in M.2 key M slot (nvme0n1p1)
DefaultDependencies=no
Conflicts=shutdown.target
After=systemd-remount-fs.service
#systemctl list-units --type=mount
After=systemd-remount-fs.service dev-nvme0n1p1.device
Before=local-fs-pre.target local-fs.target shutdown.target
Wants=local-fs-pre.target
Wants=local-fs-pre.target dev-nvme0n1p1.device
ConditionPathExists=/dev/nvme0n1p1
ConditionPathExists=/etc/setssdroot.conf
ConditionVirtualization=!container
Expand Down
8 changes: 6 additions & 2 deletions data/setssdroot.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#!/bin/sh
# Runs at startup, switches rootfs to the SSD on nvme0 (M.2 Key M slot)
#Runs at startup, switches rootfs to the SSD on nvme0 (M.2 Key M slot)
NVME_DRIVE="/dev/nvme0n1p1"
CHROOT_PATH="/nvmeroot"

INITBIN=/lib/systemd/systemd
EXT4_OPT="-o defaults -o errors=remount-ro -o discard"
EXT4_OPT="-o defaults -o debug -o errors=continue -o discard"

echo "setssdroot: mount and switch rootfs to nvme0n1p1" | tee /dev/kmsg

modprobe ext4

Expand All @@ -13,3 +15,5 @@ mount -t ext4 ${EXT4_OPT} ${NVME_DRIVE} ${CHROOT_PATH}

cd ${CHROOT_PATH}
/bin/systemctl --no-block switch-root ${CHROOT_PATH}

echo "setssdroot: exit mount and switch rootfs" | tee /dev/kmsg

0 comments on commit ea40ce6

Please sign in to comment.