Fixed filesystem corruption issues

Fixed:
filesystems were created with journaling disabled, now journaling is enabled
filesystem was mounted rw on boot, which prevented fsck from running
 - changed to ro, which then gets mounted as rw by systemd using the fstab file
 - added a fstab for the external boot devices that tries both usb and sd card
This commit is contained in:
Hal Emmerich 2019-05-23 00:19:32 -05:00
parent 9521115452
commit 7ad3f7462b
4 changed files with 12 additions and 4 deletions

View File

@ -1 +1 @@
console=tty1 init=/sbin/init root=PARTUUID=%U/PARTNROFF=1 rootfstype=ext4 rootwait rw net.ifnames=0
console=tty1 init=/sbin/init root=PARTUUID=%U/PARTNROFF=1 rootfstype=ext4 rootwait ro net.ifnames=0

View File

@ -0,0 +1,3 @@
#try both the sdcard and the usb as root
/dev/mmcblk2p2 / ext4 nofail,x-systemd.device-timeout=5s,defaults,noatime 0 1
/dev/sda2 / ext4 nofail,x-systemd.device-timeout=5s,defaults,noatime 0 1

View File

@ -58,11 +58,12 @@ then
echo Writing kernel partition
dd if="$BOOT_DEVICE"1 of=/dev/mmcblk2p1
echo Writing Filesystem, this will take about 4 minutes...
mkfs.ext4 -F -b 1024 -m 0 -O ^has_journal /dev/mmcblk2p2
mkfs.ext4 -F -b 1024 /dev/mmcblk2p2
mkdir -p /mnt/mmc/
mount /dev/mmcblk2p2 /mnt/mmc
rsync -ah --info=progress2 --info=name0 --numeric-ids -x / /mnt/mmc/
#Install a base fstab
#Remove the live-fstab and install a base fstab
rm /mnt/mmc/etc/fstab
echo "/dev/mmcblk2p2 / ext4 defaults,noatime 0 1" > /mnt/mmc/etc/fstab
umount /dev/mmcblk2p2
echo Running fsck

View File

@ -75,7 +75,7 @@ create_image() {
cgpt add -i 2 -t data -b $start -s $size -l Root $1
# $size is in 512 byte blocks while ext4 uses a block size of 1024 bytes
losetup -P $2 $1
mkfs.ext4 -F -b 1024 -m 0 -O ^has_journal ${2}p2 $(($size / 2))
mkfs.ext4 -F -b 1024 -m 0 ${2}p2 $(($size / 2))
# mount the / partition
mount -o noatime ${2}p2 $5
@ -125,6 +125,10 @@ chroot $outmnt locale-gen
chroot $outmnt apt update
chroot $outmnt apt install -y initscripts udev kmod net-tools inetutils-ping traceroute iproute2 isc-dhcp-client wpasupplicant iw alsa-utils cgpt vim-tiny less psmisc netcat-openbsd ca-certificates bzip2 xz-utils ifupdown nano apt-utils git kpartx gdisk parted rsync
#add the live-boot fstab
cp -f $build_resources/external_fstab $outmnt/etc/fstab
chmod 644 /etc/fstab
#Cleanup to reduce install size
chroot $outmnt apt-get autoremove --purge
chroot $outmnt apt-get clean