FORUMS
Remove All Ads from XDA

NTFS on your android with full read write support

8,336 posts
Thanks Meter: 20,836
 
By munjeni, Senior Member on 28th October 2014, 12:57 PM
Post Reply Email Thread
How to install this:

1. put copymodulecrc to the /data/local/tmp folder and chmod them to 755
(adb shell chmod 755 /data/local/tmp/copymodulecrc)

2. put ntfs-3g and ntfsmount to the folder /system/bin and chmod them to 755
(adb shell chmod 755 /system/bin/ntfs-3g)
(adb shell chmod 755 /system/bin/ntfsmount)

3. put sdcardfs.ko to the folder /system/lib/modules and chmod them to 644
(adb shell chmod 644 /system/lib/modules/sdcardfs.ko)

What is next? Next:

1. in order to get it working, sdcardfs.ko must be patched to match your kernel version since every kernel modules is paired with kernel by version string, so if version string not match module version it will not work! So you must patch sdcardfs.ko module using tool called copymodulecrc! Copymodulecrc will extract version string from any module of the your stockrom kernel modules and copy them directly to the sdcardfs.ko (patch them). First of all you need to look into your /system/lib/modules folder and use any .ko file NAME for referencie in next commands:
Code:
adb shell /data/local/tmp/copymodulecrc /system/lib/modules/PUT_NAME_OF_THE_KO_YOU_FOUND_IN_STOCK_ROM_KERNEL_MODULES /system/lib/modules/sdcardfs.ko
So replace PUT_NAME_OF_THE_KO_YOU_FOUND_IN_STOCK_ROM_KERNEL_M ODULES with the name of the any module you found in modules folder! Done.
2. if you completed step 1 without errors you are ready for this step. You need to locate script called install-recovery.sh (on most devices it is in folder /system/etc) and add next lines:
Code:
insmod /system/lib/modules/sdcardfs.ko
Done. On every next reboot sdcardfs kernel module will be automatically included in your kernel.
3. if you get error in patching sdcardfs.ko whole thing will not work! So these step is important! You can verify success by command: (su -c "insmod /system/lib/modules/sdcardfs.ko") , if you see error than sdcardfs is not working, if you see nothing than it is working

Since you completed these 3 things, you are ready to use NTFS volumes on your device! To understand these things:

1. first of all, you can not mount ntfs volume regulary trought settings menu since android not support ntfs by default! You must mount/umount your ntfs volume manually (you can use for example android terminal emulator when you need to mount/umount ntfs). You will not see any details about ntfs volume in settings menu since android not support ntfs by default, you can see details in most file managers only.

How to mount and unmount:

1. to mount (first connect your usb ntfs volume to your device usb port) :
Code:
su -c "ntfsmount mount"
Done! Your ntfs volume by these command is mounted and you are ready to read/write them using your faworite file manager
2. To umount (do in mind - every time before you going to remove ntfs volume from your device you must unmount it!):
Code:
su -c "ntfsmount umount"
Done! You are ready to remove ntfs volume from your usb port.

NTFS on sdcard? Yes but you need to modify a bit ntfsnount script! Don't ask me how ypu can modify them, do it byself!

Since somebody complain here about gpl licence, I am not ready ready to share sdcardfs source code with you since it is not gpl licenced, instead it is apache 2.0 licenced by Samsung guys @ 2013 and I no need to share it with you since you wanted to see them forced! I not like when somebody forcing me for something! Find it, patch them, make module of them byself

ntfs-3g is not compiled by me, it is used from here -> http://forum.xda-developers.com/show....php?t=1724078

ntfsmount script is created by me.

Copymodulecrc I do not know where I found them but here is source code:
Code:
/* copymodulecrc */

/*
 * Copyright (C) 2014 CUBE
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#include <stdio.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/mman.h>


int main(int argc, char **argv) {
	struct stat st;
	off_t filesize;
	int fd;
	char *data, *pos;
	unsigned int i;
	int bFound;
	unsigned long crcval;

	if (argc != 3) {
		printf("usage: copymodulecrc [modulename(src)] [modulename(dst)]\n");
		return -1;
	}

	if (stat(argv[1], &st) != 0) {
		fprintf(stderr, "module1 stat failed.\n");
		return -1;
	}
	filesize = st.st_size;
	fd = open(argv[1], O_RDONLY);
	if (fd < 0) {
		fprintf(stderr, "module1 open failed.\n");
		return -1;
	}
	data = mmap(NULL, filesize, PROT_READ, MAP_SHARED, fd, 0);
	if (data == MAP_FAILED) {
		fprintf(stderr, "module1 mmap failed.\n");
		close(fd);
		return -1;
	}
	pos = data;
	bFound = 0;
	for (i = 0; i < (filesize - 12); ++i) {
		if (memcmp((void *)pos, (void *)"module_layout", 13) == 0) {
			bFound = 1;
			break;
		}
		pos++;
	}
	if (bFound == 0) {
		fprintf(stderr, "module1 crc not found.\n");
		munmap(data, filesize);
		close(fd);
		return -1;
	}

	pos -= 4;
	memcpy((void *)&crcval, (void *)pos, 4);

	munmap(data, filesize);
	close(fd);

	printf("module crc=%08x\n", (unsigned int)crcval);

	if (stat(argv[2], &st) != 0) {
		fprintf(stderr, "module2 stat failed.\n");
		return -1;
	}
	filesize = st.st_size;
	fd = open(argv[2], O_RDWR);
	if (fd < 0) {
		fprintf(stderr, "module2 open failed.\n");
		return -1;
	}
	data = mmap(NULL, filesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
	if (data == MAP_FAILED) {
		fprintf(stderr, "module2 mmap failed.\n");
		close(fd);
		return -1;
	}
	pos = data;
	bFound = 0;
	for (i = 0; i < (filesize - 12); ++i) {
		if (memcmp((void *)pos, (void *)"module_layout", 13) == 0) {
			bFound = 1;
			break;
		}
		pos++;
	}
	if (bFound == 0) {
		fprintf(stderr, "module2 crc not found.\n");
		munmap(data, filesize);
		close(fd);
		return -1;
	}

	pos -= 4;
	memcpy((void *)pos, (void *)&crcval, 4);

	munmap(data, filesize);
	close(fd);

	printf("module crc copied.\n");

	return 0;
}


And finaly, files you need to install is in attachment, enjoy!
Attached Files
File Type: rar files.rar - [Click for QR Code] (643.0 KB, 8370 views)
The Following 50 Users Say Thank You to munjeni For This Useful Post: [ View ] Gift munjeni Ad-Free
 
 
3rd November 2014, 12:47 PM |#2  
Senior Member
Flag Hyderabad
Thanks Meter: 69
 
More
Will try late-night. Just asking, will it work on Galaxy S3-GTi9300?
3rd November 2014, 01:40 PM |#3  
Member
Thanks Meter: 20
 
More
Just need some clarification, when you say NTFS support, do you mean read and write or just read-only?
The Following User Says Thank You to anonyo For This Useful Post: [ View ] Gift anonyo Ad-Free
3rd November 2014, 01:40 PM |#4  
nag4pl's Avatar
Member
Flag Bangalore
Thanks Meter: 50
 
More
Quote:
Originally Posted by munjeni

Not going to explain in details, here is my tool which will add ntfs support to your android, run them and folow instructions! If you unable to patch sdcardfs.ko kernel module (giving you error when you doing insmod) than the whole things will not work on your device Curntly tested device is Xperia Z1 Compact on android version 14.4.A.0.108! Important thing is having sdcardfs installable, the rest is easy.

In order to have sdcardfs module insmoded on every reboot, you need to add one line into /system/etc/install-recovery.sh :


The rest of the tutorial you can see under application. Enjoy if you find this usefull!

/system/etc/install-recovery.sh :-
- install-recovery.sh file is not available at /system/etc/.
- Is it possible to create the file and then we can insert the line?

Am using AOSP - Carbon ROM on Xperia Z..

Thank you!!
3rd November 2014, 01:52 PM |#5  
ChinmayKunkikar's Avatar
Senior Member
Flag Pune
Thanks Meter: 1,139
 
Donate to Me
More

'A Munjeni Work' again!
Thanks a lot!

Looking forward for what all can I do with it.
3rd November 2014, 02:14 PM |#6  
naughty6t9's Avatar
Senior Member
Flag Sorry! The application Maps (process com.google.android.maps) has stopped unexpectedly
Thanks Meter: 169
 
More
Wow this will be amazing, cant wait to try...
The Following User Says Thank You to naughty6t9 For This Useful Post: [ View ] Gift naughty6t9 Ad-Free
3rd November 2014, 02:31 PM |#7  
Senior Member
Thanks Meter: 415
 
More
Quote:
Originally Posted by anonyo

Just need some clarification, when you say NTFS support, do you mean read and write or just read-only?

+1
3rd November 2014, 06:24 PM |#8  
Alex.87's Avatar
Member
Thanks Meter: 5
 
More
Quote:
Originally Posted by anonyo

Just need some clarification, when you say NTFS support, do you mean read and write or just read-only?

Quote!
3rd November 2014, 06:37 PM |#9  
Moscow Desire's Avatar
Retired Senior Moderator
Flag Somewhere in a Deep Cave on the Troll Kings Throne
Thanks Meter: 6,966
 
Donate to Me
More
Just a heads up..

On Xperia Z2 tablet with 4.4.2, connected to 1tb NTFS drive.

After modding the ko and setting all permissions, rebooting, will only "half-mount" the drive. It sees it, recognizes it, but claims drive is empty (wants to format it).

Status bar displays "Empty USB Storage"

In settings, when selecting Mount USB Storage, it briefly acts like it will mount. for a split second.

Any files I can get that can possibly help?

UPDATE: After running the mount commands via terminal, now it seems to mount it via ES File explorer. Although it sometimes still gives me the message in statusbar.

But seems to be working well.
The Following User Says Thank You to Moscow Desire For This Useful Post: [ View ] Gift Moscow Desire Ad-Free
3rd November 2014, 09:19 PM |#10  
Member
Flag Chch
Thanks Meter: 15
 
More
Seeing as this patches a kernel module will it work on rooted phones with a locked bootloader?
The Following User Says Thank You to Aborto For This Useful Post: [ View ] Gift Aborto Ad-Free
3rd November 2014, 09:22 PM |#11  
Moscow Desire's Avatar
Retired Senior Moderator
Flag Somewhere in a Deep Cave on the Troll Kings Throne
Thanks Meter: 6,966
 
Donate to Me
More
Quote:
Originally Posted by Aborto

Seeing as this patches a kernel module will it work on rooted phones with a locked bootloader?

My Z2 Tablet has a locked bootloader. So yes, it should. There's nothing going on that warrants an unlocked bootloader. Just the addition of some files and permission changes, which are normal with a rooted device.
The Following 3 Users Say Thank You to Moscow Desire For This Useful Post: [ View ] Gift Moscow Desire Ad-Free
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes