-4

I have an external hard drive with a ntfs filesystem. I have used it to backup the files under my /home (an ext4 filesystem). I choose NTFS only because it is said to be portable between Windows and Linux. But now I am not sure.

There are some files not removable on the external hdd, and I didn't know any localized solution that just focuses on the culprit files, so repaired the whole ntfs filesystem by following the advice at Why can't I remove some files on an external hard drive?

CHKDSK E: /r

on the external HDD in Windows 8.1. It reported some problems with some files, and fixed them.

Now I can remove the unremovable files. But the backup directory for all my files copied from my ext4 /home is gone (I am not sure if there are other directories also removed. It seems just now that Windows's CHKDSK narrowed to the backup directory very well. The backup directory contains files with both short and long pathnames). Instead I found new folders found.000 (with numerous file00000xxx.chk files) and Extras.

Many backup files copied from my ext4 /home have pathnames longer than Windows can recognize. Is that the reason that CHKDSK removed those files and tried to fix them? In other words, does CHKDSK remove files on NTFS copied from ext4 filesystem with longer pathnames than Windows can recognize?

Is it possible to recover the files on the ntfs hdd copied from my ext4 /home?

What filesystem would you recommend to use on an external HDD, for portability between Windows and Linux?

Thanks.

3

What filesystem would you recommend to use on an external HDD, for portability between Windows and Linux?

NTFS is just fine. You can also use exFAT or even FAT32 (if the 4GB file size limit is okay for you). All these filesystems can handle 32k character pathnames.

Your problem is Windows.

Maximum Path Length Limitation

In the Windows API (with some exceptions discussed in the following paragraphs), the maximum length for a path is MAX_PATH, which is defined as 260 characters.

and further down in the text

Starting in Windows 10, version 1607, MAX_PATH limitations have been removed from common Win32 file and directory functions. However, you must opt-in to the new behavior.

A registry key allows you to enable or disable the new long path behavior. To enable long path behavior set the registry key at
HKLM\SYSTEM\CurrentControlSet\Control\FileSystem LongPathsEnabled (Type: REG_DWORD). The key's value will be cached by the system (per process) after the first call to an affected Win32 file or directory function (list follows). The registry key will not be reloaded during the lifetime of the process. In order for all apps on the system to recognize the value of the key, a reboot might be required because some processes may have started before the key was set.

Please also read: Why does the 260 character path length limit exist in Windows?

The solution is simple. Don't use such long pathnames.

  • Thanks. Can I change the type of a filesystem (e.g. from NTFS to extat or ext4) without backing up? – Tim Mar 5 at 12:38
  • This won't help if Windows can only handle 260 characters (including prefix "x:\") -- no matter what filesystem. – Freddy Mar 5 at 12:43
  • I know it is up to OS, not filesystem. I just asked what I asked – Tim Mar 5 at 12:53
  • @Tim I don't know any linux tool that can do this in one step without backup (gparted can't with exfat-fuse and exfat-utils installed). – Freddy Mar 5 at 13:09
  • Does converting filesystem type make the existing files unreadable? – Tim Mar 5 at 13:13
1

exfat is a simple compatible choice

https://en.m.wikipedia.org/wiki/ExFAT

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.