Sorting the SD card easily

This section is for discussing everything about Next hardware and latest updates.
Alcoholics Anonymous
Posts: 781
Joined: Mon May 29, 2017 7:00 pm

Re: Sorting the SD card easily

Postby Alcoholics Anonymous » Tue Mar 02, 2021 1:27 am

Eratosthenes wrote:
Mon Mar 01, 2021 9:25 pm
P.S.: The Next's FAT stuff is based on the esxDOS routines?! *smile
No, the esxdos api (ie just the interface) is implemented as a subset but the code is new; the fact that you can use long filenames in the api is a hint :) Or relatively new as nextzxos has the +3e and residos as ancestors.

It's not about being reliable. There is no api for managing directories so you'd have to write code to write directories yourself. I don't think you can open a directory like you open file so you may have to find out where the directory file is located on the sd card and do raw io on that, working with the possibility that the directory file is fragmented. nextzxos has something in it to find out how a file is distributed on sd so it may be possible to use that.

Anyway, the issue I was thinking of is because the sort could take a while, you have to protect against user error. Like power being shut down in the middle of modifying the directory.

User avatar
Posts: 320
Joined: Mon May 29, 2017 8:17 pm

Re: Sorting the SD card easily

Postby Eratosthenes » Tue Mar 16, 2021 8:31 pm

What about:
- unmount the device on the Next
- sort the card using the Linux and maybe FATsort on the PI
- (re-) mount it again on the Next

Haven't fiddled around with the PI on the Next, it's just an idea.

THNX 4 info.

Posts: 256
Joined: Mon Jul 16, 2018 7:11 pm

Re: Sorting the SD card easily

Postby Ped7g » Tue Mar 16, 2021 9:58 pm

The Pi doesn't see the Next card directly. But the umount/mount is not even needed, if you would create dot command sorting it with Pi, it could start, read all the directory sectors and send them to Pi, and wait for response and overwrite it all back as the Pi tells it to. Meanwhile there's nothing else running on the Next, ie. nothing else changing the card data. The risk there is abrupt power off with incomplete write to the card, but that's inherent problem to FAT file systems, and besides that you should be ready to restore your Next card on a whim any way, you never know with the hobby level of various SW, when some of it will by accident destroy your data on card, so being mentally prepared to start from scratch it's recommended.

Who is online

Users browsing this forum: No registered users and 9 guests