3

Can't delete a file at an NTFS partition, even tried this in LiveCD, but at the same partition delete other files not a problem. The file couldn't be deleted is a Windows system file, maybe with special NTFS permissions. So how can I do in the right behavior?

From CLI:

sudo rm '/media/.../AppStudio.Uwp.xr.xml' 
rm: cannot remove '/media/.../AppStudio.Uwp.xr.xml': No such file or directory

From GUI:

Error removing file /media/.../AppStudio.Uwp.xr.xml: Permission denied
0

2 Answers 2

1

The reason for the permission denied error is that the partition is mounted as ro (read-only). The reason is mostly that the Windows partition is not properly shutdown and hibernated (you can try running dmesg to find the relevant lines)

You can fix this by shutting down Windows properly using shutdown /s /f /t 0 in the cmd.exe.

If that didn't fix the problem I will edit my answer to contain instructions how to manually mount the Windows Partition (in 90%+ of cases shutting down properly fixes it).

8
  • 1
    Couldn't he just edit fstab so when its automatically mounted it can be rw instead of ro? Commented Nov 9, 2019 at 21:59
  • @Qasim that's a horrible idea, it would possibly corrupt the partition. Commented Nov 10, 2019 at 12:02
  • The Windows got deleted too... Commented Nov 11, 2019 at 9:18
  • @SirMuffington how would that corrupt it, all it does it change the fileysystem attributes and makes it read, write. that in no way would corrupt it?!! Commented Nov 11, 2019 at 10:25
  • 1
    @rospa apparently currently AFAIK the only sure way is for you to boot Windows and shut it down properly, because there are tools like ntfsfix, recover from mount.ntfs in Linux but they get minimal or almost no job done to solve the inconsistency issue. If you're a risk-taker you can go ahead use the recover option, but keep in mind that according to the man page it will clear the Windows Logfile. Commented Nov 11, 2019 at 19:03
0

To expand on @sir-muffington's comment to his own answer:

A similar error can occur due to corruption in the NTFS filesystem. This happened in my case. Only I kept getting "input/output error", rather than "permission denied". It happened when I hibernated with the NTFS drive mounted, and booted the Windows it belonged to. Some files got corrupted, and I couldn't remove them or their folder.

ntfsfix couldn't help. What helped, was booting Windows, right-clicking the drive in explorer and telling it to check it - fixed the problem in a matter of seconds.

So if you've got input/output errors(and they're not because your HDD is dying) - and ntfsfix isn't fixing them - it seems like using Windows' chkdsk is the only option. As it seems that no tools on Linux have the capability to properly repair NTFS. Alternatively, you can look to live tools like UBCD4win. It's ancient and might not even boot on modern devices, but it comes with an original chkdsk on it, and is only about 400MB.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.