[clug] Debian Jessie file system checking on boot up

Scott Ferguson scott.ferguson.clug at gmail.com
Wed Apr 6 12:04:14 UTC 2016



On 05/04/16 20:11, George at Clug wrote:
>     Does anyone know how to get a Debian Jessie server to check and
> repair its root file system on boot up ?
> 
<snipped>

This 'seems' to work, I'll do a little more testing on the weekend.

Test VM:-
Debian Jessie 32-bit fully-updated
single slice ext4 partition

Changes:-

*Enable full fsck on boot (unattended) - this is a *really* bad thing to
do, fsck isn't smart enough to look for orphaned system files in Lost&Found

sed -i "s/^#FSCKFIX=no$/FSCKFIX=yes/" /etc/default/rcS

*Enable GRUB to show boot messages so I can "see" if fsck runs

sed -i
"s/^GRUB_CMDLINE_LINUX_DEFAULT=\"quiet\"$/GRUB_CMDLINE_LINUX_DEFAULT=\"\"/"
/etc/default/grub


*Create a fsck logging rule which will 'hopefully' be used in the
initramfs[*1] Note that this doesn't appear to work :(

cat /etc/e2fsck.conf
[options]
                 max_count_problems = 16
                 log_dir = /var/log/e2fsck
                 log_filename = e2fsck-%N.%h.INFO.%D-%T
                 log_dir_wait = true

*Create a custom GRUB menu entry

cp /etc/grub.d/40_custom /etc/grub.d/39_fsck

copy a menu entry out of /boot/grub/grub.cfg and modify (change title
and append "fsck.mode=force" (without the "") to the kernel line)

e.g.
#!/bin/sh
exec tail -n +3 $0
<snipped>
menuentry 'force full fsck' --class debian --class gnu-linux --class gnu
--class os $menuentry_id_option
'gnulinux-simple-48eed742-c1cc-4652-81ef-220197a031a3' {
        load_video
        insmod gzio
        if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
        insmod part_msdos
        insmod ext2
        set root='hd0,msdos1'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root
--hint-ieee1275='ieee1275//disk at 0,msdos1' --hint-bios=hd0,msdos1
--hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1
48eed742-c1cc-4652-81ef-220197a031a3
        else
          search --no-floppy --fs-uuid --set=root
48eed742-c1cc-4652-81ef-220197a031a3
        fi
        echo    'Loading Linux 3.16.0-4-586 ...'
        linux   /boot/vmlinuz-3.16.0-4-586
root=UUID=48eed742-c1cc-4652-81ef-220197a031a3 ro fsck.mode=force
        echo    'Loading initial ramdisk ...'
        initrd  /boot/initrd.img-3.16.0-4-586
}

Lastly - run the update-grub command.

On reboot if I choose the force full fsck menu entry it appears to run
(there's only 900MB of files on the VM) ,but it does not log as I'd like.

See https://scottferguson.com.au/uploads/files/fsck_test.webm




Kind regards




-- 
    A: Because we read from top to bottom, left to right.
    Q: Why should I start my reply below the quoted text?

    A: Because it messes up the order in which people normally read text.
    Q: Why is top-posting such a bad thing?

    A: The lost context.
    Q: What makes top-posted replies harder to read than bottom-posted?

    A: Yes.
    Q: Should I trim down the quoted part of an email to which I'm reply

http://www.idallen.com/topposting.html



More information about the linux mailing list