WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Linux on NTFS  (Read 11802 times)

Offline Adrian_C

  • Newbie
  • *
  • Posts: 3
Linux on NTFS
« on: December 30, 2015, 04:44:32 PM »
Hello and a Happy New Year to all Tinycore users !

If anybody is interested in booting TC from an NTFS partition (for various reasons), syslinux 4.07 and newer can load the kernel and core.gz from NTFS. As it turns out TC  may be the only Linux distribution not using the file permissions blocked by NTFS, and it can fully boot with X, sound, wifi and whatever apps are installed.

I tested in Vbox and on real hardware (BIOS) dual booting  Windows XP (NTFS version 3.1)  and TC 6.4.1. There is read-only support enabled by default so apps cannot be added/removed, no way to do backups. I'll post here if anybody needs more  detailes.

Offline Lee

  • Hero Member
  • *****
  • Posts: 645
    • My Core wiki user page
Re: Linux on NTFS
« Reply #1 on: January 01, 2016, 11:38:04 AM »
Hi AdrianC, and Happy New Year to you, too.  Welcome to the TC forums.

While booting linux from NTFS isn't ideal, it works with Tiny Core because  the the ext filesystem loaded from the initrd (in core.gz) remains the root filesystem and Tiny Core doesn't need to do much with the filesystem on the HD.  I have a few boxes floating around that have XP installed on them but on which I normally run TC 4.x.  I've been using grib4dos as my boot loader and loading ntgs3g.gz alongside core.gz to provide read/write access to the tce directory on the HD.  I haven't tried it on the more recent versions of Tiny Core, but I suppose it would work just as well.

Under most circumstances,  if I want to leave an NTFS filesystem on a machine, I prefer to boot TC from an ext2 formatted USB stick.  That way, I never even mount the NTFS hd unless I need some file from it or need storage space larger than my USB stick.  My little netbook is several years old and still has Windows Starter Edition on the hd.  Of course, I have no idea what the password is for that - I boot Core from an SD card.    :)

Hmmm... New years day... I think I'll back up that SD card.    :/

32 bit core4.7.7, Xprogs, Xorg-7.6, wbar, jwm  |  - Testing -
PPR, data persistence through filetool.sh          |  32 bit core 8.0 alpha 1
USB Flash drive, one partition, ext2, grub4dos  | Otherwise similar

Offline Adrian_C

  • Newbie
  • *
  • Posts: 3
Re: Linux on NTFS
« Reply #2 on: January 01, 2016, 07:43:57 PM »
I understand how to mount a partition with ntfs-3g read/write and to update /tce directory on that partition. But when having a single C: partition the kernel mounts it read-only before ntfs-3g is loaded. I have tried umount with various options, apparently the kernel would not release the partition it booted from,  it returnes "device busy" or "operation not permitted."

When finally unmounted it (ls in /mnt/sda1 returned nothing) and mounting /dev/sda1 with ntfs-3g the result was "no such device." A person who knows Linux explained to me that I should mount it as a loop device, without releasing it from /mnt/sda1. Would that make it writable ? Can the kernel itself be compiled with r/w NTFS support ?

If this can be made to work then it is possible to have a Windows style installer/uninstaller for TC.
Also with wine.tcz is possible in theory to read the real registry as wine_registry and to mount the real C: as wine_C:, in principle Windows apps would be accesible from Linux with all their settings and data. Something like a (peaceful) system takeover :).

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: Linux on NTFS
« Reply #3 on: January 01, 2016, 08:52:25 PM »
TinyCore already makes use of  ntfs-3g  if it is present at boot (in core.gz).
http://wiki.tinycorelinux.net/wiki:remastering

I think you're unable to umount the partition because the loaded extensions are loop mounted from there. Might work if you have  /etc/sysconfig/tcedir/copy2fs.flg  so extensions get copied to RAM which allows the boot partition to be un-mounted.
http://wiki.tinycorelinux.net/wiki:remastering_with_ezremaster?s[]=copy2fs&s[]=flg#options_for_adding_extensions_to_your_remaster

This helped me at some point creating a NTFS capable TinyCore.
http://yalis.fr/cms/index.php/post/2013/05/12/NTFS-and-modular-boot-for-TinyCore-Linux
Download a copy and keep it handy: Core book ;)

Offline Lee

  • Hero Member
  • *****
  • Posts: 645
    • My Core wiki user page
Re: Linux on NTFS
« Reply #4 on: January 01, 2016, 10:10:29 PM »
Right.  If you use ntfs3g.tcz (an extension), you get read/write access to any ntfs parition mounted after ntfs3g.tcz is loaded.  -But- if your tce directory is on the ntfs filesystem, the loop mounted extension itself keeps you from unmounting/remounting that partition so it stays read-only.  However, if you use ntfs3g.gz (a secondary initrd) or remaster ntfs3g into core.gz, then ntfs3g will be present before the partition containing the tce directory is mounted.

I think you could achieve a similar result by loading all of your "onboot" extensions, including ntfs3g.tcz, "toram" (copy2fs).  That would allow you to remount the filesystem with the tce directory after ntfs3g.tcz is loaded, but it seems to me that loading ntfs3g in the initrd is cleaner.

There might also be a way to get the desired results using httplist or tftplist, but I don't remember the details of how that stuff works.
32 bit core4.7.7, Xprogs, Xorg-7.6, wbar, jwm  |  - Testing -
PPR, data persistence through filetool.sh          |  32 bit core 8.0 alpha 1
USB Flash drive, one partition, ext2, grub4dos  | Otherwise similar

Offline Adrian_C

  • Newbie
  • *
  • Posts: 3
Re: Linux on NTFS
« Reply #5 on: January 02, 2016, 04:46:51 PM »
Thank you both, it worked ! I extracted ntfs-3g.tcz and added it to core.gz.
 Now it boots with write privileges and can install apps, do backups and swap.