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

Linux on Raspberry PI - powering off.

Options
  • 03-05-2013 11:14pm
    #1
    Moderators, Category Moderators, Entertainment Moderators, Sports Moderators Posts: 22,584 CMod ✭✭✭✭


    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 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.


  • Moderators, Category Moderators, Entertainment Moderators, Sports Moderators Posts: 22,584 CMod ✭✭✭✭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 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.


  • Moderators, Category Moderators, Entertainment Moderators, Sports Moderators Posts: 22,584 CMod ✭✭✭✭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 Posts: 14,008 ✭✭✭✭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
  • Moderators, Category Moderators, Entertainment Moderators, Sports Moderators Posts: 22,584 CMod ✭✭✭✭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 Posts: 14,008 ✭✭✭✭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.


  • Moderators, Category Moderators, Entertainment Moderators, Sports Moderators Posts: 22,584 CMod ✭✭✭✭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