SHiLLySiT
Posts: 10
Joined: Sat Aug 15, 2015 8:05 pm

Files in NTFS Partiton not visible on Windows Machine

Sun Aug 16, 2015 7:18 pm

I've moved my RPI's file system over to an external HD which is on a partition with a ext4 file system. I have another partition on the same drive with a NTFS file system. I have moved a text file and some MP3s to the NTFS partition using the RPI which works all fine and dandy. When I take the external HD to my Windows machine and plug it in, the NTFS partition is visible, but none of the files appear.

I also have samba setup so that I can access the files on the NTFS partition over the network with my Windows machine which works perfect. However, I'd like to move a large number of files which would be a lot faster if I had the HD plugged in instead of doing the transfer over the network.

Have I missed a step somewhere?

EDIT: I just created a folder with a text file on Windows and the new files are not visible on the RPI. :?

JimmyN
Posts: 1109
Joined: Wed Mar 18, 2015 7:05 pm
Location: Virginia, USA

Re: Files in NTFS Partiton not visible on Windows Machine

Sun Aug 16, 2015 7:44 pm

What does Windows say about the drive? It seems to work except when plugged directly into Windows.
Go to Windows "Disk Management" and check on the status. Is the NTFS the first or second partition on the drive, has it been assigned a drive letter, what is the status (healthy, online, primary partition, NTFS, is it showing as a basic drive or a removable drive, etc) ?

SHiLLySiT
Posts: 10
Joined: Sat Aug 15, 2015 8:05 pm

Re: Files in NTFS Partiton not visible on Windows Machine

Sun Aug 16, 2015 7:55 pm

JimmyN wrote:What does Windows say about the drive? It seems to work except when plugged directly into Windows.
Go to Windows "Disk Management" and check on the status. Is the NTFS the first or second partition on the drive, has it been assigned a drive letter, what is the status (healthy, online, primary partition, NTFS, is it showing as a basic drive or a removable drive, etc) ?
Image
https://dl.dropboxusercontent.com/u/543 ... 51_23-.png

The disk in question is Disk 2, and everything looks in order to me! I just can't see files on Windows that I've created on the RPI and vice versa.

It does complain about E:/ when I first plug in the drive, but I'm assuming that's because its ext4 format. I don't care about seeing that partition though since that's just the RPI's file system.

JimmyN
Posts: 1109
Joined: Wed Mar 18, 2015 7:05 pm
Location: Virginia, USA

Re: Files in NTFS Partiton not visible on Windows Machine

Sun Aug 16, 2015 9:07 pm

Everything does seem to be OK. Windows will complain about any partition that is not formatted FAT or NTFS, so it will always offer to "fix" it for you by formatting it. Just ignore it.

That is strange, and at this point I'd check to make sure the NTFS partition is actually being mounted on the RPi. If the mount failed and you didn't know it you'd be saving files into the mount point directory instead of to the drive. Everything would seem to work until you moved the drive to Windows and of course the files wouldn't be there since the drive was never mounted.

Look in the mount point directory when the drive isn't plugged in (mounted) and see if the files you've copied are there.

SHiLLySiT
Posts: 10
Joined: Sat Aug 15, 2015 8:05 pm

Re: Files in NTFS Partiton not visible on Windows Machine

Sun Aug 16, 2015 9:20 pm

JimmyN wrote:Everything does seem to be OK. Windows will complain about any partition that is not formatted FAT or NTFS, so it will always offer to "fix" it for you by formatting it. Just ignore it.

That is strange, and at this point I'd check to make sure the NTFS partition is actually being mounted on the RPi. If the mount failed and you didn't know it you'd be saving files into the mount point directory instead of to the drive. Everything would seem to work until you moved the drive to Windows and of course the files wouldn't be there since the drive was never mounted.

Look in the mount point directory when the drive isn't plugged in (mounted) and see if the files you've copied are there.
I can't unplug the drive because the file system is on the other partition, which would cause it not to boot. However, you are indeed right that it is not being mounted properly. The files I was creating on the RPI were just being created in that directory rather than the device. I mounted the partition to another folder and was able to see the files that the were created in Windows.

So now the question is, why is it failing to mount on start up? I've edited my fstab file:

Code: Select all

[email protected] ~ $ sudo cat /etc/fstab
proc                                                    /proc           proc    defaults          0       0
/dev/mmcblk0p1                                          /boot           vfat    defaults          0       2
/dev/disk/by-uuid/b8db07c1-713f-4fb4-b632-a36393276917  /               ext4    defaults,noatime  0       1
/dev/disk/by-uuid/6AF6F32C217C5E55                      /mnt/data       ntfs    defaults          0       0
# a swapfile is not a swap partition, so no using swapon|off from here on, use  dphys-swapfile swap[on|off]  for that
Is there something else I need to do?

EDIT: just to confirm the UUIDs are correct:

Code: Select all

[email protected] ~ $ blkid
/dev/mmcblk0p1: SEC_TYPE="msdos" LABEL="boot" UUID="15CD-3B79" TYPE="vfat"
/dev/mmcblk0p2: UUID="13d368bf-6dbf-4751-8ba1-88bed06bef77" TYPE="ext4"
/dev/sda1: UUID="b8db07c1-713f-4fb4-b632-a36393276917" TYPE="ext4"
/dev/sda2: LABEL="Data" UUID="6AF6F32C217C5E55" TYPE="ntfs"

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: Files in NTFS Partiton not visible on Windows Machine

Sun Aug 16, 2015 10:47 pm

People seem to have endless problems getting external drives to mount "automatically" on startup via the decades-old practice of putting stuff in /etc/fstab.

The modern way to do stuff automatically on startup (and by "stuff", I mean anything - mounting drives, running Python scripts, launching GUIs, you name it...), is to "hijack the login process".

Details for this are available around this forum in many (hundreds if not thousands) of places, or can probably be found in future posts on this thread.
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

RobHenry
Posts: 452
Joined: Fri Sep 21, 2012 9:04 pm
Location: UK

Re: Files in NTFS Partiton not visible on Windows Machine

Sun Aug 16, 2015 11:49 pm

Issue a mount command manually and see what error you get:

sudo mount /mnt/data

Also consider giving up on ntfs altogether. It has very poor performance on Linux and should only be used if you need to share the physical drive with a windows machine.

SHiLLySiT
Posts: 10
Joined: Sat Aug 15, 2015 8:05 pm

Re: Files in NTFS Partiton not visible on Windows Machine

Sun Aug 16, 2015 11:52 pm

RobHenry wrote: Also consider giving up on ntfs altogether. It has very poor performance on Linux and should only be used if you need to share the physical drive with a windows machine.
That is exactly what I'm doing - I'm using the NTFS partition to store media and other documents, but I'd still like to be able to plug it into a Windows machine if I need to transfer a large number of files.

EDIT:
Mounting the drive works, but i do see:

Code: Select all

[email protected] ~ $ sudo sh ./automount-data.sh
The disk contains an unclean file system (0, 0).
The file system wasn't safely closed on Windows. Fixing.
EDIT2:
Unmounting and remounting the partition seems to have cleared the above issue, I guess it was because I unplugged the drive from the Windows system without safely ejecting it?

RobHenry
Posts: 452
Joined: Fri Sep 21, 2012 9:04 pm
Location: UK

Re: Files in NTFS Partiton not visible on Windows Machine

Sun Aug 16, 2015 11:59 pm

I know this isn't what you want to hear, but ntfs is so bad on Linux that it really isn't worth the hassle.

You will get better overall performance from formatting the partition as native linux (ext4) and accessing it from windows as a shared network drive (samba/cifs) to transfer your files, no matter how large they are.

SHiLLySiT
Posts: 10
Joined: Sat Aug 15, 2015 8:05 pm

Re: Files in NTFS Partiton not visible on Windows Machine

Mon Aug 17, 2015 12:52 am

RobHenry wrote:I know this isn't what you want to hear, but ntfs is so bad on Linux that it really isn't worth the hassle.

You will get better overall performance from formatting the partition as native linux (ext4) and accessing it from windows as a shared network drive (samba/cifs) to transfer your files, no matter how large they are.
While I appreciate the advice, any performance issues have not been noticeable to me. As I mentioned, I'm using the NTFS partition for backup/storage, so performance really does not concern me. Since all my other systems are running Windows, I'd rather have my data more accessible.

Back to the problem at hand; I wrote the following command to a script and added the file to rc.local:

Code: Select all

mount -t ntfs /dev/sda2 /mnt/data
While it works if I run the command manually, it doesn't work on boot. :(

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: Files in NTFS Partiton not visible on Windows Machine

Mon Aug 17, 2015 1:08 am

While it works if I run the command manually, it doesn't work on boot.
What error message do you get?
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

SHiLLySiT
Posts: 10
Joined: Sat Aug 15, 2015 8:05 pm

Re: Files in NTFS Partiton not visible on Windows Machine

Mon Aug 17, 2015 1:12 am

Joe Schmoe wrote:
While it works if I run the command manually, it doesn't work on boot.
What error message do you get?
I'm not seeing any errors in /var/log/syslog, unless I'm looking at the wrong log file.

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: Files in NTFS Partiton not visible on Windows Machine

Mon Aug 17, 2015 1:48 am

You need to look at the screen at the end of the boot process.

rc.local runs as the last step of the boot process. When you see the message:
My IP address is 192.168.xxx.yyy
that comes from rc.local. Look around there for any other messages.
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

JimmyN
Posts: 1109
Joined: Wed Mar 18, 2015 7:05 pm
Location: Virginia, USA

Re: Files in NTFS Partiton not visible on Windows Machine

Mon Aug 17, 2015 3:00 am

Try running rc.local manually and see if you get any messages.

Code: Select all

sudo service rc.local start
If not try adding this to rc.local after your script

Code: Select all

/path/to/yourscript >/tmp/mount.results 2>&1
And then run rc.local again. That should write all the output to a file you can look at.

Return to “Beginners”