Marmite Sandwich's picture

Linux, samba and NTFS amateur here. The context is a TKL home fileserver for Windows PCs, which is also a music server via UPnP/DLNA. Only one user (me), not bothered about high security, no web server, very simple, trying to avoid learning and using linux CLI, so Webmin if possible. Well, I got the music server stuff working fine, using an external USB disk in FAT32. I could even edit the data from a Windows PC, after I set the Security and Access Control>Writable? to Yes (in Webmin).

Then I decided to replace the FAT32 disk with a NTFS formatted disk (due to max file size limits etc.). Same data, did all the same things when mounting, setting up the share, setting Security and Access Control>Writable. But I only have read access to the data now. What gives?

Marmite

Forum: 
Jeremy Davis's picture

Firstly apologies on he essay. There is a fair bit of somewhat subtle context required to answer your question fully. Hopefully it isn't too dense.

I'm not totally up with Windows stuff, but AFAIK the NTFS in Windows 8+ is not quite the same NTFS as on Win 7 and previous (which Linux's NTFS driver is built to work with). Because NTFS is an MS proprietary format, only Microsoft really know how it works (and they aren't sharing with anyone). Some really generous and clever people have managed to reverse engineer it, hence why there is a Linux driver for it. But it's a moving target and without open and public documentation and specifications (which I don't expect MS to do anytime soon), it will never be as reliable or robust as any of the native Linux formats, when used within Linux.

Also from Windows 8 onwards, AFAIK Windows uses a feature called "fast start" which essentially just means that when you "switch off" Win 8+ it doesn't do a full shutdown (as previous versions of Windows did), it actually just hibernates. I mention this because if you formatted the drive in Windows 8 (or higher), unless you explicitly unmount the volume before exiting Windows, the drive will be flagged as "unsafe" to write to. And with good reason; if a hibernated NTFS partition has been written to with Windows "off" (hibernated), Windows will blue screen when next started.

If this particular drive were only to be used with your Linux server, then I would recommend that you use ext4 instead. It's an open source filesystem which has all the advantages of NTFS and none of the issues (at least under Linux). But as this is a removable drive which you also want to use with Windows, then it's not such a good option. There are ext2/3/4 drivers for Windows, but in my experience (back when I was a Windows user - probably 6 or so years ago) it's pretty flaky and probably less stable than NTFS on Linux. So NTFS is probably your best option.

I'm assuming not, but if using ext4 is an option, there are fifty million (I'm only exaggerating a little) internet tutorials on how to format drives and partitions under Linux (Debian and Ubuntu instructions should work fine). And perhaps it's really obvious and easy under Webmin too?! Regardless, that will obviously require a backup as formatting is a destructive process (i.e. all current data will be lost).

So with that preamble out of the way, and assuming you want to press on with NTFS; the first thing I'd check for is that you have the full NTFS driver installed (without it you can only ever mount as read only).

I know you said you'd prefer Webmin instructions, but personally rarely use it and I find it convoluted and time consuming to work out. I also find it much more work to precisely explain UI navigation without screenshots or video (i.e. in words only). And anything other than words takes tons more time and effort for me (I can quickly and easily fill in any gaps in my knowledge using google, rather than needing drawn out trial and error).

Also I find it a bit opaque. Sometimes things say they work but don't (as per your experience), other times they say they don't work, but the errors aren't always meaningful and unless it displays the same error as the commandline would, it's really hard to google for the cause. I'm sure the commands are possible in Webmin, but I'm not 100% sure and don't have the time to do the research. So sorry, but I'm going to show you the commandline way to make my life easier.

So, to check for (and install if necessary) the proper NTFS drivers (ntfs-3g):

apt-get update && apt-get install ntfs-3g

If that installed anything new, then reboot:

reboot

Now hopefully it works. The first thing to double check is that the filesystem is now mounted as read/write (rw). Here's a simple one liner which will show what (if any) filesystems are mounted as ro (read only):

egrep " ro,|,ro " /proc/mounts

On my laptop (running Debian - what TurnKey is based on), it looks like the only ro file location on my system is /sys/fs/cgroup; see the raw output below:

$ egrep " ro,|,ro " /proc/mounts

tmpfs /sys/fs/cgroup tmpfs ro,nosuid,nodev,noexec,mode=755 0 0

If your NTFS partition is listed there, then there's still something wrong. The next step to take, probably depends on your setup. If you formatted it with NTFS on Windows and intend to use it on Windows a fair bit, I'd suggest that you connect it to a Windows machine and run a chkdsk on it. When it's done, make sure that you unmount it from Windows (8+) before you shut Windows down.

If you primarily plan to use it with your Linux box, then I'd recommend that you reformat it with NTFS within Linux. It will use an older reverse engineered version of NTFS (rather than the current "proper" MS version). But it should still work on Windows and should be more stable under Linux. But that's your call.

If it was formatted NTFS under Linux or you're willing to take a chance, you could try ntfsfix (sort of like Linux version of chkdsk for NTFS). I haven't ever used it before, but I've heard that it is often helpful. It's part of the ntfs-3g package and works like this:

ntfsfix /dev/sdXn # where 'X' is the appropriate letter and n is the partition number

Make sure you only run it on an unmounted partition (if it's mounted, umount it first). Assuming you NTFS drive is /dev/sdb1 then you would run:

ntfsfix /dev/sdb1

Hope that helps...

Marmite Sandwich's picture

Thanks Jeremy. Don't apologise for the essay - it all helps. This was fixed as soon as I installed ntfs-3g, as suggested by you above. The disk had been formatted and populated on a W10 PC which maybe explains it.

Marmite.

Add new comment