Unified Directory Structure Theory

Published on January 4, 2023 at 4:21 am by LEW

Introduction

In this post I will be trying to come up with a somewhat unified directory structure for divergent requirements. Specifically a dual boot computer running Linux and MS Windows, unifying local directories across both Operating Systems (OS), including cloud storage/Access via other devices.

I was thinking about a node to Tolkin, instead of Hawking, by calling this post “the Directory of Power”. But since this is still an ongoing project, I will default to “Theory” instead.

This project is centers around merging two different file systems, under different OS’s, and their related technologies to achieve, a coherent directory structure that will help make user data across platforms easier to organize and access.

This is going to be a somewhat theoretical discussion of the subject matter. It will be specific to my current situation. However, that is unlikely to match anyone else’s setup. Therefore consider the points I discuss theoretical, and you should endeavor to understand the concept, then interpret them in relation to your setup.

Existing Structures

Most modern OS’s have a user or home directory structure for us to store our data (user and home will be used interchangeably in this post). This separates our personal data and information from system data and information, as well as other users data and information. This is a good thing, and there are a several benefits to doing this; security, privacy, and backups.

Most OS’s provide a sub structure within the user home directory consisting of “Well Known” directories. These include Downloads, Documents, Music, Pictures, Videos, and the like. These and other similar folders will be present in current versions of MS Windows. They can also, depending on your setup, be present in your Linux home folder. The mechanism for creating and maintaining these directories is dependent on your OS.

Under normal circumstances when dual booting, your home directories for each OS are separate. This means that what is done in one OS is not available to the other OS.

Cloud Storage

Another factor that has been added in recent years is cloud storage (your data being stored on remote servers). This is generally good for redundant backups (assuming your cloud provider does not go out of business). However depending on who supplies your cloud service, security and privacy could be an issue.

We will need to make allowance for cloud storage space. Not all data will necessarily need to be uploaded and shared. And depending on your cloud storage solution, it may not be possible. There will need to be a division of some sort between data uploaded, and data that remains on your on your computer.

My Hardware Setup

My current setup consists of a dual boot desktop computer, laptop, phone, tablet, an online hosting server, and several servers/test rigs.

Generally I share information between my desktop and laptop. However there is some data that I also want to have available on my phone. Tablet and test rigs.

Dual Boot Overview

Internal storage on the desktop consists of a 256 GB M.2 drive and a 1 TB SSD. On this system I dual boot MS Windows 10 and Arch Linux.

I am going over my configuration here. Use this as reference only. I hope you understand the principles and can apply them to their own unique situation.

The M.2 drive is more responsive than the SSD, so I will be using it as my boot drive. Both operating systems will go on it. This will also be an UEFI installation, so the M.2 will need to be set as GPT, with an EFI partition.

The M.2 drive has limited space. Because of this I will be setting up a separate application partition on the SSD (this is for Windows 10), as well as a separate data partition.

This is my partition map for the project. It is not ideal, and involves compromise. Obviously the data and application partition would be better off as EXT4, but that is not practical. To share data with Windows (since Windows does not play nice) the drive types have to be FAT32 or NTFS. FAT32 has some limitations around maximum file size and security, leaving NTFS. So I fire up my drive pratitioner (fdisk in my case) and get to it.

Note the numbers will not be exact because I am rounding, and as you may also know advertised drive space does not equal real drive space. Also this meets my needs. You may have different needs, like a bigger application partition, a smaller data partition, more room for Windows, or any of a variety of other needs.

The Install

When building a dual boot system always always install MS Windows First (remember Windows does not play nice)! When installing Linux we can fix the Windows boot loader deficiencies by replacing it with a much more robust boot loader.

Install Windows: Once Windows is installed in the correct partition, there are a few things I usually like to do.

Just don’t do anything with the user directories at this point. After ensuring everything is functioning correctly you should set a restore point. And if you really wanted to be complete, a disk image of the partition.

Install Linux: Before starting the Linux install, make sure your installer has the NTFS-3G available. This is an open source implementation of NTFS. Check your distros documentation or ask someone. In Arch you just need to make sure to install the ntfs-3g package before mounting drives.

During the installation process you will want to mount the data partition someplace. I use /srv. This is normally for server stuff, but since this is a desktop it is a free and open directory/mount point.

Depending on your disto and desktop you may have xdg-user-dirs utility running. This is a program that makes those “well known folders” in your home directory. You will need to disable it, or make it point to new locations. In my case I disabled it.

Note that in Linux you will not be mounting the Windows partition or the application partition. Just like Windows does not see the swap file or the Linux partition.

When you get to the point of setting up the grub boot loader, you want to make sure it identifies your windows partition correctly. In Arch you will need to load a program called os-prober, and add a line to etc/default/grub that says “GRUB_DISABLE_OS_PROBER=false”. Debian based distributions should do this automatically.

Web Server

I will be running NextCloud on a web server that will act as my cross device cloud storage. Because of the limitations of my current situation (behind CGNAT) I have leased space from a provider to run my NextCloud instance. So in this case it is truly in the cloud, not on some hardware I keep kicking under my desk.

Note that when I am running my web server from a local machine I have enough space (2 TB) to put everything in the cloud. Using a hosting plan puts a limit on storage (generally up to 100 GB on less expensive plans), so I will have to pick and chose what I want to store in the cloud.

Setting Up Shared Files

NextCloud: Install the NextCloud client and connect it to your NextCloud Server. During the setup you will be able to chose what folder NextCloud will sync too. This will have a default name of Nextcloud. However during setup you can change its name and location. I put it in the /srv (data) partition and rename it to data.

Initially everything on your NextCloud server will be downloaded. You can then fine tune what sub directories will actually sync. Go in and check/un-check all directories to sync initially.

Cross OS Home Directories

You can move to Linux or Windows first. It does not matter. Go to your user home directory. If the well known directories are present move them to the data partition.

In Linux: you can drag and drop. My data partition is mounted at /srv. So I would have directories like /srv/data/documents and /srv/data/pictures. Just make sure you have either modified xdg-user-dir locations or have disabled the utility.

Next create links to theses folders in your home directory. Now when you click on the links, the actual location will be /srv/data instead of /home/user.

In Windows: right click on a folder and select properties. From here you can change the location to the data drive. Windows should automatically leave a link behind. So point Documents to Documents, Music to Music, Videos to Videos, etc, etc.

Now you can go back to settings in the NextCloud Client and select the directories and sub-directories you want to sync with the cloud. Then sit back and wait for everything to sync.

Other Devices: I do a similar process with the NextCloud client on my Android phone, Android tablet, and laptop.

Conclusion

In this post I setup Linux and Windows on my dual boot desktop to use the same well known files on a separate partition, and synced selected files with a NextCloud Server instance.

Whether I am logged into Windows or Linux I can still access my data stored in well known directories. And where necessary, the shared data can be synced across multiple devices with a fair amount of control.

Add New Comment

Your email address will not be published. Required fields are marked *