Skip to content
nikp123 edited this page Mar 24, 2024 · 5 revisions

Welcome to the NTFS-ROOTFS wiki!

In this wiki we will guide you through the steps required to have a fully functioning Linux installation on NTFS.

Overview

FAQ

Why?

Because there are moments where people just don't like partitioning or the chance of ruining their preexisting Windows installation and like the convenience of installing a Linux distro in their existing NTFS partition.

How?

You know that fuse exists and ZFS exists and that ZFS can be used as the rootfs. So since NTFS-3G runs on fuse, why couldn't NTFS be a root filesystem. NTFS has unofficial POSIX support by enabling the permissions option in mount. So we can just put fuse drivers and ntfs3g into the initramfs.

What about the bootloader?

GRUB4DOS ftw! And on EFI any bootloader since EFI partitions exist.

Can I put my installation in a directory (like C:\Linux or /mnt/windows/Linux)?

Absolutely, just follow this guide.

How stable?

Apart from not being able to shutdown the machine, it's pretty stable.

Performance

Not too great, high cpu (about 20-40% on a 2010 Atom) usage because of permission conversion, but if you are a light user you won't really notice a difference.

Do I have to disable Hibernation and Fast boot on Windows.

YES, DO IT NOW.

How do I vertify if I have done it properly

  • It should boot.
  • You should be able to log in.
  • You should be able to modify files in your /home directory
  • You should test if sudo or SUID flags work.
  • You should check if chown, chmod..etc. work.
  • You should check if the changes are persistent.

Getting started

First, you should check the compatibility list.

For now, currently these distros work:

Preinstall setup

So first, what will you do is create the ntfs partition or have your current Windows installation.

If you have a Windows installation I suggest you create a directory that will contain the Linux install like C:\Linux.

Don't forget to disable Secure Boot, Fast boot and Hibernation. This will prevent you from Linux not being able to boot because the partition is unbootable.

Once you're done, you need find a compatible distro or try to install on your own and possibly contribute to this guide ;)

ArchLinux

Preinstallation stuff

First get your favourite ArchLinux iso, can be even a derivative, but you MUST HAVE THE ABILITY TO INSTALL OVER pacstrap.

And once you're booted you must have ntfs-3g installed on your ArchLinux live system.

And mount the partition with -t ntfs-3g which will mount it with NTFS-3G.

For the other partitions like /boot, /home, etc. mount them relative to the directory which you will be installing. Like, suppose that /mnt/windows is your C: drive and /mnt/windows/Linux is where you want your Linux to be installed. Then you should mount /home to /mnt/windows/Linux/home, you know what I mean...

Once you're done with that in your pacstrap command you would want to install Arch with base, ntfs-3g and base-devel and add the -d parameter to the pacstrap command which will avoid the warning about not being able to install to a non-mountpoint directory, and proceed to install as usual.

Once you're done installing the system (DO NOT REBOOT) you must configure the bootloader and initram.

mkinitcpio-dir

For Windows users while chrooted, you must get a AUR helper working... I know it's a pain, but it's possible.

For others, aka. the ones that just want a pure install to a partition. You may skip this part.

And from that AUR helper get the mkinitcpio-dir package.

Once you got it, open up /etc/mkinitcpio.conf with your favourite text editor and add dir to HOOKS.

Configuring initram

Once you are in a chroot, open /etc/mkinitcpio.conf with your favourite text editor and remove filesystems from the HOOKS.

This will prevent from mkinitcpio crapping itself when it realizes that your rootfs is NTFS.

Instead of it, add fuse to the MODULES line and add mount.ntfs-3g mount.ntfs mount.fuse to the BINARIES line.

This will add the appropriate binaries required for mounting the filesystem.

And while you are still in /etc/mkinitcpio.conf add the appropriate MODULES and BINARIES for the other filesystems which will you mount on your system.

Save, exit, and run mkinitcpio -p linux to generate the initram.

Configuring the bootloader

Open up the configuration for your bootloader and add the following to your linux kernel line.

rootfstype=ntfs-3g rootflags="permissions,acl,recover,noatime (for those who want better performance)" for those who install it directly on the drive and additionally add dir=/$YOURLINUXDIR for those who installed it in a directory.

Regenerate your bootloader configuration if you have to and proceed further.

Generating fstab

For those who run in a directory, remove the / entry from fstab.

This will prevent a systemd from crapping itself when it notices a directory install.

Instead we will create a systemd service that will remount the rootfs.

Copy the existing configuration from this repository in arch/remountrootfs.service to /etc/systemd/system/remountrootfs.service and enable the service by running systemctl enable remountrootfs.service.

And for those who don't run in a subdirectory, add the mount options we added eariler to the bootloader options under rootflags.

Final notes

You will not be able to properly shutdown, reboot the system. Apparently fixed by using ACL flag (see: https://github.com/nikp123/ntfs-rootfs/issues/5). Please tell me if it works so I can take this comment out.

This comment is irrelevant if the acl flag actually works: Instead, when shutting down you will have to after some time manually power off the system.

Contribution

If you somehow fixed the issues that appeared during the install or made a guide on how to install it on a different distro, create a issue or a pull request.

Thanks

As you may or may not have noticed I cloned vadmium's mkinitcpio-dir, it had some issues while building so that's why I cloned it. And he made the initcpio script, so huge thanks to him.