Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ghost Drive #32

Open
bkirshh opened this issue Jan 20, 2022 · 2 comments · May be fixed by #57
Open

Ghost Drive #32

bkirshh opened this issue Jan 20, 2022 · 2 comments · May be fixed by #57
Labels
bug Something isn't working

Comments

@bkirshh
Copy link
Collaborator

bkirshh commented Jan 20, 2022

On occasion when the power is abruptly cut to the RaspberryPi running dencam, USB attached storage drives (microSD cards in card readers) do not appear to be properly ejected. The name of the drive appears to stick in /media/pi.

Several of my Pi's (I am currently testing five with four different batteries) have been neglecting to display the second status page. This, as I have come to find out, is because the system is remembering the names of my attached storage when the pi is not properly shut down (nearly every time I just pull the plug). This is easy enough to solve (just ssh in and cd /media/pi and sudo rmdir X). But in the field, this could be catastrophic as these pseudo-replicated drives prevent dencam.py from writing to either the external or internal storage.

Potential fix:

EDIA_DIR = '/media/pi'

def clearGhostDrives():
    """Delete non-existent USB drives"""
    # When power is removed (no shut-down) and a USB drive is removed, 
    #  then the power is restored, a ghost folder is left in /media/pi/
    # Distinguishing between ghost folders and real ones has proven to be too much of a challenge
    # Instead, this function deletes all the USB folders
    # This is executed when powering up, before the USB drive is mounted
    # Therefore, after this removes all the folders, the system mounts the USB drive that actually exists

    # Locals
    DEL_DIR_CMD = 'sudo rm -r %s/%s'

    usbDrivesList = os.listdir(MEDIA_DIR)
    if len(usbDrivesList) > 1:
        for usbDriveName in usbDrivesList:
            doLinuxCmd(DEL_DIR_CMD % (MEDIA_DIR, usbDriveName)) 
@iamgarcia iamgarcia self-assigned this Jan 30, 2022
@iamgarcia iamgarcia added the bug Something isn't working label Jan 30, 2022
@iamgarcia
Copy link
Collaborator

iamgarcia commented Feb 4, 2022

@bkirshh I have been unsuccessful in being able to replicate this issue. Are you able to replicate this issue? If so, could you provide me with the exact steps that you did to cause the ghost drive issue? Thanks!

@bkirshh
Copy link
Collaborator Author

bkirshh commented Feb 9, 2022

After my devices stabilize (we fix the slow DenCam issue) I'll try again to replicate. In the meantime can you try pulling the power on a functioning DenCam over and over again, maybe ten times. Don't properly shut it down, just pull the power as the files are writing. See what happens.

@iamgarcia iamgarcia linked a pull request Feb 12, 2022 that will close this issue
@iingram iingram added software and removed software labels Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

3 participants