3.3. Creating the Directory Layout on the Target Partition
After the target partition exists, mount it and create the base directory tree deliberately so the rest of the build lands in the paths you intended.
Section 3.1 defined the layout policy, and 3.2 defined variables such as LBI_ROOT, LBI_BOOT, and LBI_ESP_MOUNT. This section applies that policy to the real partition the reader already prepared.
In this stage, the primary layout is created under /system, while traditional FHS paths at / are exposed as symlinks that point into /system/*.
All command examples in this section should be run as the root user.
Confirm the Target Mount
Before creating directories, ensure the target partition is mounted where the build expects it. The examples below assume that mount point is LBI_ROOT.
mkdir -p "$LBI_ROOT"
mount /dev/ROOT_PARTITION "$LBI_ROOT"
If the root partition is not mounted first, directory creation commands will run against the host filesystem instead of the new system tree.
Create the Base Layout
Create the custom directory layout under its own /system tree on the mounted partition:
mkdir -p "$LBI_ROOT/system"
for d in configuration binaries systembinaries libraries headers share documentation tools users charlie
do
mkdir -p "$LBI_ROOT/system/$d"
done
If this installation uses variable runtime storage in its own top-level path, create that now as well:
mkdir -p "$LBI_ROOT/system/variable"
Create Boot and ESP Paths
Create the boot mount path you chose, then create an ESP mount path only if your installation uses one.
mkdir -p "$LBI_ROOT$LBI_BOOT"
mkdir -p "$LBI_ESP_MOUNT"
If the reader is reusing an existing ESP that is mounted elsewhere during setup, adjust LBI_ESP_MOUNT first and then create only the path that matches that decision.
Add Compatibility Symlinks
The intentional layout remains primary under /system, but standard FHS paths should exist as compatibility links:
ln -sf system/configuration "$LBI_ROOT/etc"
ln -sf system/binaries "$LBI_ROOT/bin"
ln -sf system/systembinaries "$LBI_ROOT/sbin"
ln -sf system/libraries "$LBI_ROOT/lib"
ln -sf system/users "$LBI_ROOT/home"
ln -sf system/charlie "$LBI_ROOT/root"
ln -sf system/variable "$LBI_ROOT/var"
mkdir -p "$LBI_ROOT/usr"
ln -sf ../system/binaries "$LBI_ROOT/usr/bin"
ln -sf ../system/systembinaries "$LBI_ROOT/usr/sbin"
ln -sf ../system/libraries "$LBI_ROOT/usr/lib"
ln -sf ../system/headers "$LBI_ROOT/usr/include"
ln -sf ../system/share "$LBI_ROOT/usr/share"
ln -sfn libraries "$LBI_ROOT/system/lib"
This keeps core FHS paths and common /usr/* compatibility paths available from the start. Additional compatibility links can be added later as needed, but creating this core set now reduces surprises during early toolchain stages.
The /system/lib link exists for software that looks for the traditional library directory under a prefix. It points at /system/libraries, so do not create data directories through that path.
Add Mount Directories for Optional Partitions
If the reader created separate partitions such as /users, /variable, or another dedicated mount path, create those mount directories at their real locations under /system before any additional mount calls.
mkdir -p "$LBI_ROOT/system/users"
mkdir -p "$LBI_ROOT/system/variable"
The rule is straightforward: every partition that will be mounted inside the target tree must have a deliberate directory waiting for it.
Validate Before Continuing
A quick tree listing should show the intended top-level structure on the mounted partition, not on the host root:
ls -la "$LBI_ROOT"
Once this structure is in place, the rest of the build can assume a stable target layout and avoid accidental path drift later.
Next Steps
It is now recommended to give your user account permission to write into the target tree so the build can run without sudo after this point. The exact command depends on your user and group names, but it will look something like this:
chown -R $USER:$(id -gn) "$LBI_ROOT"
root. A typo at this privilege level can damage your host, destroy data, or make the system go kaboom. If you skip the ownership handoff and continue the build as root, that same risk persists for every later build and install command. Double-check device names, mount points, and LBI_ROOT before pressing Enter.