I believe the question is clear. But will add some details and history. I have two systems Win10 and Manjaro Linux. After reboot from Windows to Linux, I try to mount NTFS file systems, and mount often fails with the message about unclean cache. The medicine is ntfsfix /dev/sdXX or better ntfsfix /dev/disk/by-label/my-ntfs-partition I added string to fstab:

LABEL=Media        /media/Media    ntfs   nofail         0       2

I want Linux fixes NTFS for me. So if mount fails, it should call ntfsfix, and then retry mount. Please help me to explain Linux what I want. enter image description here

Try this. Create a bash file containing the following and set it to run at startup.

#!/bin/bash

#delay for 10 seconds 
sleep 10

#Check to see if Media has failed to mount and carry out the fix
if ! mount | grep Media > /dev/null; then
    ntfsfix /dev/disk/by-label/my-ntfs-partition && mount -t ntfs /dev/path/to/ntfsdisk /media/Media
else
    exit
fi

Running scripts on startup varies depending on the desktop environment so I can't really comment on that. E.g. Achieving it in Gnome is different to Openbox.

Hope this helps.

  • Thank you for idea. But I want to add this script into system's autostart. Not user's. I already know the right way. Will add it here after test. – kyb Aug 19 '16 at 14:44
  • Ah, okey dokey. No bother – I_GNU_it_all_along Aug 19 '16 at 14:50

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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