:: Re: [DNG] runit: unclean shutdown?
Inizio della pagina
Delete this message
Reply to this message
Autore: Steve Litt
Data:  
To: dng
Oggetto: Re: [DNG] runit: unclean shutdown?
Didier Kryn said on Mon, 13 Mar 2023 10:51:06 +0100

>Le 13/03/2023 à 03:47, Steve Litt a écrit :


>> swapoff -a
>>
>> The preceding prevents swapping from changing any disk content...
>>
>> umount -r -a -t nosysfs,noproc,nodevtmpfs,notmpfs
>>
>> The preceding recursively unmounts all disk filesystems (as opposed
>> to /sys, /proc, etc.)
>>
>> mount -o remount,ro /
>>
>> The preceding remounts the root partition as read-only, so further
>> changes cannot be made to it, but its executables can still be used
>> to perform the final shutdown tasks. Note that if /usr is a separate
>> partition and there's no /sbin, those executables won't be available.
>> You'll need to do some fancy copying before the mass unmount. Oh,
>> Lennart!
>>
>> sync
>>
>> The preceding confuses me a little because my first instinct would be
>> that sync wouldn't work on a read-only filesystem, because what sync
>> does is write cached disk writes to disk. A quick web search yielded
>> nothing on this subject. But perhaps sync *does* work on readonly
>> filesystems. If that's the case, leaving out the sync would leave
>> cached writes and perhaps would trigger a journal recovery on the
>> next reboot. So if you haven't yet, but a sync command after you've
>> unmounted all disk partitions and set the root partition read-only.
>>
>> SteveT
>
>     Hi Steve.
>
>     I'm pretty sure umount flushes the write buffers associated to
> the
>given partition and, therefore, there is no need for sync before it.


Thanks Didier, I have more questions...

Does the umount -a unmount the root partition / ?

If so, why the   -o remount    ? If not, the root partition wasn't
flushed.


Do you know whether sync can flush a readonly root partition?



>For what concerns 'mount -o remount,ro' , there is still the issue of
>file metadata being modified if you don't specify noatime. I would  do
>'mount -o remount,ro,noatime'


I'll do that. I'll also make /etc/fstab specify noatime on all my
mounts. It's quite an oversight that I haven't done this already.

>
>      I don't know for the f. acls. For my own systems, all partitions
>are always mounted with noacl; therefore I would also add it in the
>remount.


I've never thought about acls. What's the benefit to using noacl on
mounts?

Thanks,

SteveT

Steve Litt
Autumn 2022 featured book: Thriving in Tough Times
http://www.troubleshooters.com/bookstore/thrive.htm