I have a file sitting on an NTFS partition that I am unable to delete or move. I am able to view the file. This is also preventing me from reading that directory while inside Windows. I get the error; "The file or directory is corrupted and unreadable" when trying to access this directory while inside Windows.

[root@ziggurat var]# ls -al .piw\?PageNum\=0 
-rw-r--r-- 0 ttucker root 2016 Jan 28 08:56 '.piw?PageNum=0'

[root@ziggurat var]# rm -i .p*
rm: remove regular file '.piw?PageNum=0'? y
rm: cannot remove '.piw?PageNum=0': No such file or directory

[root@ziggurat var]# mv .piw\?PageNum\=0 derp
mv: cannot move '.piw?PageNum=0' to 'derp': No such file or directory

If I try to edit the file with vim I see ".piw?PageNum=0" [Permission Denied] at the bottom left.

If I try to modify the permissions I get the following error:

[root@ziggurat var]# chmod 777 .piw\?PageNum\=0 
chmod: cannot access '.piw?PageNum=0': Input/output error

More information:

This is a second drive which contains one partition. The partition was created inside Windows 10. This partition does not contain my Windows C Drive - this drive is completely separate from my Linux root and Windows oot partitions.

[root@ziggurat var]# pwd

[root@ziggurat var]# df -h /mnt/storage/
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       932G  197G  736G  22% /mnt/storage

[root@ziggurat var]# fdisk -l /dev/sda
Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 91985B34-E4D8-4F7B-ABF4-7F2E27482077

Device     Start        End    Sectors   Size Type
/dev/sda1   2048 1953523711 1953521664 931.5G Microsoft basic data

Even more information:

While inside Windows I am not able to switch into the var directory. I receive the message: The file or directory is corrupted and unreadable. I am able to view and modify anywhere else in the drive.

The file was initially created, likely, with a botched wget command.

The file is there and I can cat it to STDOUT. The contents are HTML from a US Patent webpage.

[root@ziggurat var]# cat .piw\?PageNum\=0 
<!-- PageNum=0  -->
<!-- NumPages=0 -->
  <HEAD><TITLE>Patent Images</TITLE></HEAD> 
... clipped for brevity ...

Here is the OS and ntfs-3g info:

[root@ziggurat var]# pacman -Ss ntfs
extra/ntfs-3g 2016.2.22-1 [installed]
    NTFS filesystem driver and utilities

[root@ziggurat var]# uname -a
Linux ziggurat 4.9.6-1-ARCH #1 SMP PREEMPT Thu Jan 26 09:22:26 CET 2017 x86_64 GNU/Linux

Final note:

I also tried running umount'ing the drive and running ntfsfix on it. This did not help.



I chmod 777'd the var dir... Then ran chown -R root:root var, received this error: chown: changing ownership of 'var/.piw?PageNum=0': Input/output error ... then ... looking in the dir:

[root@ziggurat var]# ls -ltra
ls: cannot access '.piw?PageNum=0': Input/output error
total 3116333
-????????? ? ?       ?             ?            ? '.piw?PageNum=0'
-rw-r--r-- 1 ttucker root     250910 Jan 28 08:56  0.pdf

Ugh... I think the drive is just jacked <-- technical term

Second Update:

After running the chown on the directory mentioned above I then rebooted into Windows. During the Windows load it stated that it was checking the drive for consistency (or something of that language) Anywho... it works now. The file is gone and I am able to read it in Windows.

Additional information which may be helpful to others:

I have two drives with the same files on them; an internal backup drive and an external backup drive. Both are NTFS and both var dirs could not be accessed in Windows. After resolving the issue with the internal drive I found that deleting the "goofy" named files resolved the issue on the external drive as well. Example:

-rwxrwxrwx 1 root root       2016 Dec 31 22:31 '.piw?PageNum=0'
-rwxrwxrwx 1 root root       8379 Dec 31 22:32 '.piw?PageNum=0&docid=01111111&IDKey=DE3F91CB19BB%0D%0A&HomeUrl=http%3A%2F%2Fpatft.uspto.gov%2Fnetacgi%2Fnph-Parser%3FSect1%3DPTO1%2526Sect2%3DHITOFF%2526d%3DPALL%2526p%3D1%2526u%3D%25252Fnetahtml%25252FPTO%25252Fsrchnum.htm%2526r%3D1%25'

For some reason, perhaps because I did not run ntfsfix, on the external drive I was able to just delete those two "problem files" and then read that directory in Windows.

Thanks all!


This appears to have been a combination of a funny file name:


... and then an ntfsfix ...

Eventual solution was messing around with file perms and ownership, then a restart into Windows (which checked the disk for consistency).

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.