Contents

Home folders: having standard organization, OneDrive, S3

In this article, I’ll try to explain my thoughts on how to organize files in different home folders (Windows and Linux). It’s definitively not an easy question in term of synchronizations, backups, or even ease of use.

Why having standard folders?

We all have friends with a Desktop/ (or an home directory) full of things, everything at top level. While this is messy, it’s also really difficult to synchronize or backup because you can only take decisions globally.

The idea behind standard folders is to permit to classify your files depending on their usage and make appropriate decisions:

  • What to synchronize between computers (is it local, remote only, or synchronized)
  • What / how seriously to do backup (1, 2, 3 copies, history kept)
  • In which drive you want them (abstraction from physical storage)

All operating systems (Windows, Mac, Linux/freedesktop.org) have similar concepts, so no need to reinvent the wheel:

  • Documents/: generic documents
  • Desktop/: temporary or frequently used documents
  • Pictures/, Videos, Music, etc: specializations by file types

Again, the strategy reposes on your will to follow the standard, no exceptions or each of them need a dedicated backup/synchronization plan.

Well, in practice it is a really bad idea to try to synchronize/store remotely/backup some kind of folders, it can lead to very poor performances, or even worst: it can be ultra dangerous to synchronize automatically! Think about generated files, databases and disk images…

We can talk about a few special cases:

  • Code projects, with a tons of files, generated files, etc… (not fitting Documents/ well): I created a Projects/ folder locally instead (each project being backed-up by git)
  • Adobe Lightroom’s catalog (database with tons of files)(not fiting Pictures/ well): I moved the catalog locally
  • User generated backup files (for example Adobe Lightroom’s catalog backups, or crypto keys)(not fitting Documents/ well because of different backup needs): created a Backups/ folder
  • Virtual Machines disk images (not fitting Documents/ well): moved locally.
  • User Profile installed apps (portable installations): I created an Applications/ folder

My setup

On Windows

Choosing OneDrive

My Windows machine is my main computer. My choice is to have something automatically synchronized with my phone, convenient and well integrated. I want it to work even in the case of network failure (local mode).

OneDrive propose something really afordable, especially with Microsoft 365 Family offers (1TB/account).

Having two copies (one local, one remote) with simple versionning (kept 30 days if I understood well) is sufficient in term of backups for the documents I have on my Windows machine (I put them on my Linux machine via SAMBA if they’re really important).

Special Folders

Folder Locations Details
3D Objects/ OneDrive (kept Local) Manually moved in OneDrive folder by using “location” special folder feature
Desktop/ OneDrive (kept local)
Documents/ OneDrive (kept local) VMWare Virtual Machines moved outside locally
Downloads/ Locally
Music/ OneDrive (kept local)
Pictures/ OneDrive (kept local) Adobe-Lightroom catalog moved outside locally
Videos/ OneDrive (kept local)
Applications/ OneDrive (kept local) Manually created in OneDrive folder
Projects/ Locally Each project backed up by git

Or more concretly:

/images/20230908/onedrive.png

Setup

I’ll not cover OneDrive’s setup which is already well covered online. OneDrive can move for you the special folders Desktop/, Documents/, Music/, Pictures/ and Videos/ into its main folder.

/images/20230908/3DObjectsLocation.png

For 3D Objects/ special folder, this operation has to be done manually, go to folder’s option, and use “Location” Tab (we’re in 2023, please don’t use registry solution, this is ugly!).

/images/20230908/alwayslocal.png

As I want to use OneDrive storage as an additional copy for my files, I right-clicked on OneDrive’s root folder to set option “Always keep on this device” (meaning all files are available offline and online). This way it will recursively sets the options to all SubFolders.

On Linux

Choosing Amazon S3

I use Linux machine for serious things (documents importants for me).

My choice is to have something really reliable with annonced availability, thus I looked at professionnal offers. As this is not my main machine, I’m ok to stop working in case of network failure.

I decided to go with Amazon S3 because:

  • you have several storage classes, depending on the needs, majority being replicated 3 times
  • it can be versionned
  • lifecycles can be parametrized to automatically move data between classes
  • it is eventually consistent (consistent reads after writes), which is rarely the case for other providers

Having three replicas + versionning is sufficient in term of backups for me for documents I have on my Linux machine.

Special Folders

Folder Locations Details
Desktop/ S3 Day 15: moving to Intelligent Tiering, Old versions: day 15, moving to Glacier Deep Archive, day 365: deleted
Documents/ S3 Idem
Downloads/ Locally
Music/ S3 Idem
Pictures/ S3 Idem
PublicShare/ S3 Idem
Templates/ S3 Idem
Videos/ S3 Idem
Backups/ S3 Day 15: moving to Glacier Instant Retrieval. Old versions: day 15: moving to Glacier Deep Archive, day 365: deleted
Projects/ Locally Each project backed up by git

Or more concretly:

/home/MYUSER
├── Downloads
├── MYBUCKET
│   ├── Backups
│   ├── Desktop
│   ├── Documents
│   ├── Music
│   ├── Pictures
│   ├── PublicShare
│   ├── Templates
│   └── Videos
└── Projects

Setup

s3fs

I simply declared my s3fs mount in /etc/fstab. I’ll not documents options I used as it is well covered in manual, but defining a local cache is important to reduce costs (especially since Intelligent Tiering will rise costs by moving to a more performant tier on read) and latency (mine is huge: 500GB).

Special Folders

On Linux, special folders can be setup using freedesktop.org (XDG) standard, simply edit $HOME/.config/user-dirs.dir (if your window manager follows that standard, these folders will have a special icon):

XDG_DESKTOP_DIR="$HOME/MYBUCKET/Desktop"
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_TEMPLATES_DIR="$HOME/MYBUCKET/Templates"
XDG_PUBLICSHARE_DIR="$HOME/MYBUCKET/PublicShare"
XDG_DOCUMENTS_DIR="$HOME/MYBUCKET/Documents"
XDG_MUSIC_DIR="$HOME/MYBUCKET/Music"
XDG_PICTURES_DIR="$HOME/MYBUCKET/Pictures"
XDG_VIDEOS_DIR="$HOME/MYBUCKET/Videos"

NFSv4 exports

As I have different Linux machines that reads my /home by NFSv4 it’s important to detail two points in /etc/exports:

  • crossmnt: Your /home has to have the option so clients can transparently mount sub-shares.
  • fsid: you must also declare your /home/MYUSER/MYBUCKET share. Normally NFSd recognize drives by using UUID. s3fs like any fuse mount does not have any UUID but you can fake it with an arbitrary fsid.

I’m facing a bug with NFS, when creating a file, it is not seen by the NFS client until folder is modified also (for example by touch .), the update_parent_dir_stat options is supposed to fix that but it does not work here. Github issue

Samba shares

Nothing special if your /home is already shared via samba, but I faced a weird situation:

  • if you try to move a file from Windows’s OneDrive to Linux’s s3fs (via samba), be sure your file don’t have the “Always keep on this device” option, otherwise this metadata will prevent your file from being accepted by s3fs. Related Mystic Windows error is 0x80070032

Have fun !