unable to revert to main filesystem

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
User avatar
philwilkinson40
Posts: 63
Joined: Tue Nov 14, 2017 3:11 am
Location: Perth, Australia

unable to revert to main filesystem

Post by philwilkinson40 » Sun Jul 08, 2018 2:09 am

I am running a uSD card shield on a esp8266 devboard

I am able to mount the SD card using

Code: Select all

import machine, sdcard, os

sd = sdcard.SDCard(machine.SPI(1), machine.Pin(15))

os.umount('/')
vfs=os.VfsFat(sd)
os.mount(vfs, '/sd')
os.listdir()
I can then open and append files in the /sd directory. However I can't revert back to the main filesystem using

Code: Select all

import flashbdev
os.umount()
os.VfsFat(flashbdev.bdev)
which returns MemoryError: memory allocation failed.
I am not sure I am using VfsFat correctly.
Any ideas?

yeyeto2788
Posts: 28
Joined: Wed Mar 30, 2016 4:09 pm

Re: unable to revert to main filesystem

Post by yeyeto2788 » Mon Aug 13, 2018 10:59 am

Have you tried something like this:

Code: Select all

os.chdir("/")
I guess that once you mount the filesystem if you do a `os.getcwd()` it will return the mounted volume (not sure).

I would just try that out to see if it works.

Regards.

OutoftheBOTS_
Posts: 847
Joined: Mon Nov 20, 2017 10:18 am

Re: unable to revert to main filesystem

Post by OutoftheBOTS_ » Mon Aug 13, 2018 9:27 pm

I do believe that u find files on sd card in "/sd/" and files on the flash in "/flash/"

so

Code: Select all

os.chdir("/flash")
should get you to the flash file system

and

Code: Select all

os.chdir("/sd")
will then get you back to the sd file system

yeyeto2788
Posts: 28
Joined: Wed Mar 30, 2016 4:09 pm

Re: unable to revert to main filesystem

Post by yeyeto2788 » Tue Aug 14, 2018 6:02 pm

I haven't tested yet but I guess that changing directory should work. Have you tried it?

I reply to the post to see if that could help you out, my thoughts were that when you mount the SD card the current working directory would be the SD that's why I supposed that with os.chdir() would do the trick. :(

Post Reply