Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Linux on Raspberry PI - powering off.

  • 03-05-2013 10:14pm
    #1
    Registered Users, Registered Users 2 Posts: 22,584 ✭✭✭✭


    Firstly, sorry if there is a better forum for this, and secondly please excuse my beginners ignorance of linux.. :)

    Have been playing with a raspberry PI recently and I'm just trying to understand one of its peceularities.

    If you power off at an inopportune moment -i.e. when it's writing something - then the filesystem seems to irreversably corrupt itself - windows nt style.

    Is this a feature or the linux filesystem in general or is this just the hardware being used? (as in storing everything on a SD card?)

    Is there any way to prevent this in linux? Like a psuedo raid system?


Comments

  • Registered Users, Registered Users 2 Posts: 1,731 ✭✭✭GreenWolfe


    It's just an RPi thing. Those boards don't have ACPI support, and I don't think any other ARM-based board has it either.

    You could try entering "sudo shutdown -h now" at a terminal (without the quotes) and pulling out the power cable when the system says that it's halted.


  • Registered Users, Registered Users 2 Posts: 22,584 ✭✭✭✭Steve


    Yeah, was looking at remotely invoking a "sudo shutdown now" on power loss - seems like a workable approach - and have considered a NiMh battery / mini UPS to allow it but that introduces a whole new set of nightmares..

    I was more wondering if USB memory might be more immune to corruption?

    The interweb says that it has to boot from the SD but after that, the filesystem can be put elsewhere.


  • Registered Users, Registered Users 2 Posts: 1,731 ✭✭✭GreenWolfe


    I wouldn't be 100% sure but I seriously doubt USB memory would be any more resistant to sudden shutdowns.

    Have you considered an SMS controlled power switch for your Pi? Halt the system then text the switch to turn the socket off. It sounds nice in theory, but I have absolutely no idea how you'd do it though.


  • Registered Users, Registered Users 2 Posts: 22,584 ✭✭✭✭Steve


    It's not a problem when I know there's a power off coming - if you know what I mean.. it's the unknown ones that are corrupting everything. :(


  • Registered Users, Registered Users 2 Posts: 14,048 ✭✭✭✭Johnboy1951


    Steve wrote: »
    It's not a problem when I know there's a power off coming - if you know what I mean.. it's the unknown ones that are corrupting everything. :(

    That is likely to happen regardless of OS ....... pull the power when writing and you have potential bother.

    I would be inclined to do a small battery backup with a 'shutdown now' issued if the main PSU failed.

    Same thing that is done on my main desktop using a UPS.

    I might even consider doing it after reading this thread :D

    EDIT: search for "5V Mini UPS" ...... there are devices available on line ;)

    EDIT2: Interesting DIY project ...

    http://homepage.eircom.net/~nigelbrooke/Electronics_Projects/SEPIC_UPS_for_Raspberrry_pi.html


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 22,584 ✭✭✭✭Steve


    I guess I was hoping there was a software option but it doesn't look likely.

    Yeah, there are a few hardware options out there using batteries to keep it alive long enough for a clean shut-down, I guess I'll have to go down that route.

    Thanks for the replies :)


  • Registered Users, Registered Users 2 Posts: 14,048 ✭✭✭✭Johnboy1951


    Steve wrote: »
    I guess I was hoping there was a software option but it doesn't look likely.

    Yeah, there are a few hardware options out there using batteries to keep it alive long enough for a clean shut-down, I guess I'll have to go down that route.

    Thanks for the replies :)

    Presently I am using mine as a server so all it does is read from the storage, so I guess there is little likelihood of anything being upset by a power off here.

    The OS is running 'Live' so does not get corrupted either.


  • Moderators, Society & Culture Moderators Posts: 9,689 Mod ✭✭✭✭stevenmu


    I don't know a lot about Linux file systems, but with Windows most of these problems happen because of cached writes. Basically when you are writing to the file system, it doesn't write directly there, it writes to some location in memory instead and then at some later point in time that gets physically written to the disk/storage in the background. With Windows you can configure it to not do this, given how configurable Linux is, I'm sure you can do the same. This wouldn't completely eliminate the issue of course, but it could reduce the chances of it a lot.


  • Registered Users, Registered Users 2 Posts: 22,584 ✭✭✭✭Steve


    It's a weird one. Yeah, I understand disc caching principles but even without anything running that writes to the SD it still happens.

    In an ideal world, I'd like there to be a read-only partition containing the bootable OS - or - something that could recover from a corruption event by restoring a stored image of a good OS.

    Need to keep digging and learn more about the OS I guess. :)


Advertisement