r/selfhosted • • 5d ago

Need Help Storage Directory Structure

Post image

This is the structure of my NAS storage that I've come up with and tweaked over the years. I would love to hear any feedback of ways it could be better, or discussions on alternatives and pros/cons. I'm very passionate about this and love nerding out over small directory improvements and little (or sometimes, big) tweaks that improve my storage organization!

Here are the objectives that have shaped this structure:

  1. Private vs Public Data: Separate data into "private" (my personal data which is irreplaceable) and "public" (data produced by others and publicly available to acquire). This allows me to easily back up data that is irrecoverable and limit access for specific apps to only public data.
  2. Temporary vs Permanent Data: Keep temporary data, download, and staging areas separate from curated data libraries.
  3. Application Independence: Organize data by content type rather than by the application that manages it, allowing applications to be replace without changing the underlying data.
  4. Balance Directories: Balance categories and sub-directories to allow good organization without too much directory depth or path lengths.
  5. Consistent Naming Conventions: Use lowercase with directories for simplicity in navigation and scripting, and use consistent naming conventions for each data type.
  6. Human-Readable Organization: File and directory names should be human-readable and self-descriptive, allowing data to be located, identified, and accessed without relying on a specific application or its database
  7. Single Authoritative Copy: Maintain a single authoritative copy of each file, avoiding unnecessary duplication. Multiple apps can access the same file, with read-only access where possible.
  8. Hardlinks: Downloads and media should be in the same share and file system so the Arr stack can use hardlinks which saves space and disk writes. Also, since not all downloads are media, the downloads directory should remain separate from the media directory.
542 Upvotes

60 comments sorted by

•

u/asimovs-auditor 5d ago

Expand the replies to this comment to learn how AI was used in this post/project.

→ More replies (1)

19

u/Aide_Sea 5d ago

Looks solid :) I'd maybe add a separate spot for app state (docker volumes, databases). It's not really private or public but it hurts to lose, and DBs don't like being copied while running, so I just dump them before the backup runs.

7

u/Onward-Upword 5d ago

Oh good point. I completely forgot that part. I actually run a separate server with docker where all the volumes and databases live. The compose files live in the private/software/docker/stacks directory and then I backup any configurations to the private/software/backups folder. then if I need to rebuild the server I run my "docker up" script and it rebuilds all the apps and points them back at the permanent data.

I'll have to think up a 9th point for that and maybe even make a separate list to describe how the software itself is organized.

2

u/Aide_Sea 5d ago

Nice, that sounds like a clean setup. Compose files plus a rebuild script is basically the whole recovery plan :D Just maybe test a restore once in a while, that's usually where the surprises are..

36

u/SimpleTeacher5046 5d ago

Stash mentioned. I see you buddy

22

u/Onward-Upword 5d ago

Haha, yup. It's a subtle enough name that is clear to those who know and not an issue for those that don't want to know

4

u/dannytbone 4d ago

How did you make the picture?

3

u/Onward-Upword 4d ago

I just pasted my markup text of my model I keep in documentation (Obsidian) into ai and asked it to make it into an image. it doesn't look good in reddit but this is basically it:

- data/

- private/

- documents/

- media/

- audio/

- music/

- pictures/

- videos/

- software/

- backups/

- docker/

- daemon/

- stacks/

- emulation/

- games/

- scripts/

- public/

- downloads/

- jdownloader/

- nzbget/

- complete/

- incomplete/

- qbittorrent/

- complete/

- incomplete/

- torrentfiles-complete/

- torrentfiles-incomplete/

- watch/

- slskd/

- complete/

- incomplete/

- media/

- books/

- audiobooks/ — `<author name>/<bookname>.m4b`

- ebooks/ — `<author name>/<bookname>.epub`

- import/

- magazines/ — `<magazine name>/<issue name>.pdf`

- movies/ — `<movie name> (<year>)/<movie name> (<year>).mkv`

- music/

- artists/ — `<artist name>/<album name>/<song name>.flac`

- playlists/ — `<playlist name>.m3u`

- singles/ — `<song name>.flac`

- soundtracks/

- games/ — `<game name>/<album name>/<song name>.flac`

- movies/ — `<movie name>/<album name>/<song name>.flac`

- shows/ — `<show name>/Season <##>/<episode name>.mkv`

- sounds/ — `<sound name>.wav`

- stash/

3

u/prutprit 5d ago

r/datacurator

Not very active, but full of interesting posts and a nice wiki

2

u/Onward-Upword 5d ago

I'll check it out, thanks!

8

u/Yann39 5d ago

Personally, I prefer to organise my folders by theme/category rather than by type.

For example, if you have images, videos and documents folders, when you go on a trip and take photo/videos, do you split the travel documents in the documents folder, the photos in the photos folder and the videos in the videos folder with 3 dedicated subfolders (/images/trip1, /videos/trip1, /documents/trip1) ?

I prefer to have a trips folder, with a sub-folder for each trip (/trips/trip1, /trips/trip2, etc.), each containing everything related to that trip, the same goes for other categories like cars, games, events and so on.

9

u/Onward-Upword 5d ago

Oh, I'm glad you brought that up! I actually struggle to know how to organize those and have that exact example. In documents I have a "Trips" folder which will have a "<location><year>" folder, and then a doc with itinerary, photos, maps, tickets, etc. it's more for what I will need on that trip vs saving photos of that trip to that folder. It's not a really well structured thing, just something I never improved on.

Are your trip folders similar or do you also keep pics/videos of the tip in that folder? I normally just open whatever image app (immich atm) and browser to that geo-location or that time to see the photos.

2

u/SpaceTurtles 5d ago

Just as a heads up, I provided an alternate possible solution in this comment that works with your current structure.

1

u/Yann39 5d ago edited 5d ago

Actually I keep what I store separate from what I share.
Over time, I've noticed that I often don't want to share (or process in any tool) all the data, just a portion of it (i.e. not all the photos from a trip, just a few of them).

So I have a main storage drive which contains all my data, backed up 3-2-1. On the drive I have a travel folder, within that folder each trip is named "city - date" or "country - date" (e.g., "Barcelona - August 2019" or "Iceland - March 2015"), each containing everything related to that trip, all mixed together (documents, photos, videos). If I feel the need to create subfolders, I might do so but for trips that hasn't been the case so far.

Then, whatever I share is duplicated on the server, for example I use Lychee (not immich) as a web gallery to share photos/videos to the family, Lychee is not connected to my storage drive, instead I put only needed files on the lychee folder on the server (or upload them via the UI).

That way there is also no risk of a tool altering the original files (that was my biggest fear, I remember a post right here on Reddit where a user reported that a misuse/bug in a tool had messed up all their files).

That's not perfect, but for my case it works better than organising by file type.

1

u/SpaceTurtles 5d ago edited 5d ago

File tagging of some kind is my preferred solution for this.

I've never been arsed to set up something comprehensive. The usual way is dump to a temp folder, standardize the name based on metadata (YYYY-MM-DD hh mm ss - Trip Name (Optional Subject Matter Here)) or something similar, then sort to final folders. When retrieving later, if you want things for a specific trip, you just filter everything with the trip name.

Usually, if I want to find something having to do with a specific trip, it's a specific type of document from that trip, so I'm going to be starting in one of those folders: images, videos or documents. I also may not remember which trip it was on if there were multiple trips to the same location, so if I have location_2025 and location_2026, I can search location to get everything from my trips to that location. If I want everything from a specific trip, I'll just pull from the top-level media folder.

Applying tagging metadata of some sort is more elegant, but runs into the situation of it not working everywhere you want to access them, and it not being visible if the standardization is missed, so keeping it in the filename is usually safe.

In general, I strongly prefer drilling down from "less specific" to "more specific" data, and anything that doesn't fit into a data hierarchy should be metadata, not folder structure. documents could drill down into things like statements, personal records, communiques if you wanted to get more granular with it, for instance, but I find I don't generate enough to really need to sort those out.

(Tip: PowerTools for Windows includes a tool for mass file renaming.)

2

u/Onward-Upword 5d ago

Yeah, I use metadata extensively for some things and not others. I should really look more into that as there are probably really useful metadata fields I'm not even using right now, especially for documents.

I used to use PowerRename and AdvancedRenamer on Windows, but I haven't done a large batch since switching to linux, so I'll probably need to hunt around for some new tools. So far I've used Kid3 for audio tagging which is pretty decent.

2

u/kaipee 5d ago

I do the first, categorised by file type.

That makes it easier to enable datasets per file content, enable or disable compression and other filesystem tuning based off file characteristics.

1

u/Yann39 5d ago

Yes, it really depends on what you do with the files.

I personally keep what I store separate from what I share or connect to applications.
I often don't want to share or process everything, and I especially don't want to risk my original files being altered.

The main thing is that it suits your needs.

2

u/Ok-Comfortable6371 5d ago

I thought it was really cool, even using CasaOS which already has its own file structure. I hope to be able to build another one using this. Thank you.

4

u/Onward-Upword 5d ago

Oh CasaOS is one of the few I never ended up trying but it looks nice. What kind of file structure does it use?

2

u/psylenced 5d ago

It's similar to what I planning on doing.My other idea is to use an OverlayFS style system.

So public/purchased and private/downloaded sit over the top of each other and it gets shared and appears as one single file system while using it. But still keeping the physical separation.

3

u/Onward-Upword 5d ago

Interesting, I’ve never heard of this and didn’t even know it was an option. I’ll definitely research on that method!

1

u/8070alejandro 2d ago

I assume that it only works for reading and modifying, not for creating a file, no? For those instances you would have to either work behind the OverlayFS or use for feature of it to select which FS to go, right?

1

u/psylenced 2d ago

I haven't looked into it in depth yet because my todo list is a mile long, but my understanding is that the lower levels are generally set to readonly. Then a single write layer is mapped as the upper layer to handle all writes.

For storage (this use case) I actually prefer to keep my shares readonly where possible to prevent accidental writes and data loss. Also the upper layer can either be set to a persistent file system, or a ram/temp fs (wipe on reboot) depending on needs.

I'm sure though that you can configure it with some logic to handle multiple write layers, but that would be a more advanced config, and need some playing with to get working how you want it.

Lots of major products use OverlayFS - docker, k8s, android, so I'm sure the advanced configs should be able to handle most people's variations. So will just need to look up the finer details and nuances to see how to set it up.

2

u/abandonedsaints 4d ago

I’m curious - how do people who download videos from YouTube/Instagram/X/etc. have them organized?

1

u/Onward-Upword 3d ago

When I used Tube Archivist and Pinchflat I believe I just used the default storage method that those apps used. If I remember correctly Tube Archivist didn't have a great human readable storage method, so I switched to Pinchflat which I liked better

49

u/Asstronaut-Uranus 5d ago

Looks good, love the public private part

32

u/DubInflux 5d ago

Unlike you, some may not think OP’s public private part should be in public :)

3

u/TheFumingatzor 5d ago edited 5d ago

Johnny•Decimal, bruv. Trust me.

2

u/Onward-Upword 5d ago

I'll check it out, Thanks!

5

u/kbd65v2 5d ago

stash 👀

4

u/real_carddamom 4d ago

It is the largest folder with 12TB in size!!!

1

u/Dangerous_Joke_1380 5d ago

So, do Sonarr and Radarr get passed the whole public folder root? To take advantage of hardlinks? Or do you pass them the downloads then just the movies/tv shows folders separately

1

u/Onward-Upword 5d ago

Yeah, the arr apps get access to the entire public folder, which isn't great for least access security. I suppose I could create separate download folders and even separate qBittorrent container instances like some people do, but that seems like more clutter than is preferable. I haven't come up with a better way so far.

1

u/Dangerous_Joke_1380 5d ago

Gotcha. I'd do the same, it's simplest. It's a solid structure overall, I like it very much

1

u/sustemlentrum 5d ago

When is you music public and when is it private?

2

u/Onward-Upword 5d ago

Public music is something that is published that exists in a public database and can be purchased. Private is my own music, either recordings of me playing or midi tracks and audio projects that I made that aren't a published album.

1

u/No-Signature-918 5d ago

Looks pretty thought through, the private/public split is the part I'd keep for sure. The one thing that'd trip me up is having music in both private/media and public/media — with your single-copy rule I'd want one of them to be the real library and just point everything else at it, otherwise the two drift apart and you forget which side a file went to. Only other habit that's saved me is a quick sweep for strays, files that landed directly in a folder that should only hold subfolders:

find /data/public/media -maxdepth 1 -type f

It catches the odd file that missed its folder before it piles up. Otherwise the layout looks solid.

3

u/Onward-Upword 5d ago

oh yeah, that one is pretty confusing. The music in the private side is my own music I made or recorded that isn't a published album that could be re-purchased. Those are the only copies and if those get lost they are gone forever, so I treat them a little better in regards to security and backups. I should probably come up with a unique name for that folder

1

u/m1kemahoney 5d ago

Is the stash folder just a holding folder, or is it really Stash-Linux?

2

u/Onward-Upword 5d ago

No it's a proper stash. I didn't want to go into a gratuitous amount of detail about the organization of that section just to keep it PG.

1

u/CornucopiaDM1 5d ago

Probably follows rule 34.

1

u/____-_---___--_____- 5d ago

Why emulation and games are private?

2

u/Onward-Upword 5d ago

That’s a good question. Partly, because that was their legacy place and I never found a better place for them. Party because I treat them more like irreplaceable files as some would be really hard to replace now (obscure mods, old games not sold anywhere anymore)

1

u/OverallLifeguard6265 5d ago

I’m curious what’s in that stash folder

1

u/Onward-Upword 4d ago

Same basic structure: media type directories and then human readable filenames with metadata

1

u/ecnahc515 4d ago

Store books in a folder, rather than top level as files. It works better for audiobooks that are multiple mp3s and I believe audiobookshelf requires it too.

1

u/Onward-Upword 4d ago

Yeah, I used to do that when it was a limitation to use audiobookshelf. However I have now converted my library to only allow single file books and audiobooks which all my current servers and players are able to handle. Having one file per ebook/audiobook is much cleaner and less deep of a directory (Strategy number 4) with less needless duplication (Strategy number 7) of files. Even though they aren't technically duplicates, 1 file per book, and one single folder of files per author is much easier to both go through as a human, and less chaotic (imo at least). Mentally I think of grabbing one book off the shelf and similarly I think of grabbing one file for that book, one book = one unit. And I can't see any benefit of having more files except when I was forced to by audiobookshelf.

I'm curious to know if there are other benefits to having the book split into 1 file per chapter that I'm not seeing though. It wouldn't be the first time I've been wrong (or even just inneficient) about how I'm organizing

1

u/ecnahc515 4d ago edited 3d ago

It's less about what's better and what's available. I definitely prefer m4b files but sometimes mp3 are all there is. I could convert everything but it's an extra step I don't want to take myself.

1

u/Onward-Upword 3d ago

Oh I see. Yeah I've definitely run into that issue as well. I guess there is always the ideal setup and then the real world compromise version

1

u/tombo12354 3d ago

The nzbget, qbittorrent, and docker makes me think you use the arr stack. If so, how do you manage those programs interacting and having very specific requirements about how they see mounted folders.

I assume you have to expose the Public folder into them, and then set the downloads and media folders. Any issues with configuration there?

1

u/Onward-Upword 3d ago

Yup, I've used the arr stack for over 10 years in many different configurations.

I'll just paste the answer I gave to "Dangerous_Joke_1380" below if you don't mind:

"Yeah, the arr apps get access to the entire public folder, which isn't great for least access security. I suppose I could create separate download folders and even separate qBittorrent container instances like some people do, but that seems like more clutter than is preferable. I haven't come up with a better way so far."

That setup has worked really well once I finally figured out how to get hardlinks to work over the multiple layers of an NFS mount and docker bind mount. Hardlinks are amazing! The only drawback/tradeoff is to use them with my structure I end up giving WAY more directory access to those apps than I would like to.

1

u/talentedfingers 23h ago

Is \data a single filesystem? Just curious if you split them up with different blocksizes or snapshot schedules. That was something I wrestled with myself. Having \download and \media on the same filesystem seems important to make file sorting easier with simple filesystem directory changes instead of copying data blocks between filesystems.

1

u/Onward-Upword 16h ago

Yes, /data is a single file system and a single nfs share. I used to have 2 separate ones, but aside from having two mounts, I was also organizing and moving a massive amount of data between them, and rather than spend 2 hours copying and killing my drives faster, I decided it was best to have a single share that just changes pointers in seconds or minutes.

/download and /media HAVE to be on the same file system and nfs share to allow for the arr stack to use hardlinks which also save time, space, and drive wear. There is a lot of conflicting information out there but I can confirm that it IS possible to use hardlinks via an nfs share.

1

u/superslow_jerry 4d ago

We get it, you goon

1

u/davidjimenez75 3d ago

SDIRS - Alias (Samsung DIRS) = easy sync Windows + Linux + Mobile Phone + Tablet with Beyond Compare 5

```

├───Alarms

├───Audiobooks

│ ├───audiobooks

│ │ ├───audiobooks--2025

│ │ └───audiobooks--2026

│ └───audiolibros

├───Books

│ ├───ebooks

│ │ ├───ebooks--2025

│ │ └───ebooks--2026

│ └───libros

│ ├───libros--2025

│ └───libros--2026

├───DCIM

├───Documents

├───Download

├───Movies

│ ├───4K Video Downloader+

│ ├───MTV

│ ├───Videos

│ │ ├───videos--2025

│ │ └───videos--2026

│ └───Videoteca

├───Music

├───Notifications

├───Pictures

│ ├───pictures--2025

│ ├───pictures--2026

│ └───wallpapers

├───Podcasts

└───Recordings

````

1

u/capilarenerviioptice 1d ago

This is a nice approach. Thanks for sharing.