The disk contains an unclean file system: Difference between revisions
Created page with "Category:Ubuntu Category:Ubuntu Storage Category:2015 Mounting an external disk you would also use with Windows 8, 10 or newer you might get an error that looks s..." |
|||
| (7 intermediate revisions by the same user not shown) | |||
| Line 2: | Line 2: | ||
[[Category:Ubuntu Storage]] | [[Category:Ubuntu Storage]] | ||
[[Category:2015]] | [[Category:2015]] | ||
<!-- repair readonly --> | |||
Mounting an external disk you would also use with Windows 8, 10 or newer you might get an error that looks somewhat like this: | Mounting an external disk you would also use with Windows 8, 10 or newer you might get an error that looks somewhat like this: | ||
Ubuntu error | |||
Ubuntu error | The NTFS partition is in an unsafe state | ||
Error mounting /dev/ | Error mounting /dev/sdXN | ||
Exited with non-zero exit status 14 | Exited with non-zero exit status 14 | ||
The disk contains an unclean file system | The disk contains an unclean file system | ||
Metadata kept in Windows cache, refused to mount | Metadata kept in Windows cache, refused to mount | ||
The reason for this might be the Windows hibernation feature. When you shutdown Windows the services are not stopped but instead are hibernated and pick up were they left the on the next boot. Only when you choose 'restart' everything is really stopped. | = From terminal = | ||
Find your device name (here referred to as sdXN) | |||
<syntaxhighlight lang=bash> | |||
lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL | grep -e sd | |||
</syntaxhighlight> | |||
Try re-mount from the terminal: | |||
<syntaxhighlight lang=bash> | |||
device=/dev/sdXN | |||
mountpoint=/media/wilbert/Data | |||
#un-mount | |||
sudo umount $device | |||
#mount read/write | |||
sudo mount -t ntfs-3g -o rw $device $mountpoint | |||
</syntaxhighlight> | |||
Possible result: | |||
The disk contains an unclean file system (0, 0). Metadata kept in Windows cache, refused to mount. Falling back to readonly mount because the NTFS partition is in an unsafe state. Please resume and shutdown Windows fully (no hibernation or fast restarting.) | |||
Note: to view the files on the mounted device with Nautilus, all instances need to be closed first | |||
= Fix = | |||
The reason for this might be the Windows hibernation feature. When you shutdown Windows, the services are not stopped but instead are hibernated and pick up were they left the on the next boot. Only when you choose 'restart' everything is really stopped. Apparently there is also some speed to be gained by leaving your disks in a mess. If you are sure to have disabled this, note that with updates it might be turned on again without asking you. | |||
You could disable the hibernation feature in Windows: | You could disable the hibernation feature in Windows: | ||
| Line 23: | Line 52: | ||
You could clean-up the NTFS partition from within Ubuntu: | You could clean-up the NTFS partition from within Ubuntu: | ||
Install Linux NTFS tools: | |||
<syntaxhighlight lang=bash> | <syntaxhighlight lang=bash> | ||
sudo apt-get install ntfs-3g | sudo apt-get install ntfs-3g | ||
sudo ntfsfix / | </syntaxhighlight> | ||
Fix: | |||
<syntaxhighlight lang=bash> | |||
device=/dev/sdXN | |||
mountpoint=/media/wilbert/Data | |||
#un-mount | |||
sudo umount $device | |||
#fix | |||
sudo ntfsfix $device | |||
#mount read/write | |||
sudo mount -t ntfs-3g -o rw $device $mountpoint | |||
</syntaxhighlight> | |||
=Snippets= | |||
== Show who and what is using the device == | |||
<syntaxhighlight lang=bash> | |||
mountpoint=/media/wilbert/Data | |||
device=$( mount -l | grep $mountpoint | cut -d' ' -f1 ) | |||
echo $device | |||
sudo fuser -v -m $device | |||
</syntaxhighlight> | |||
== Cleanup == | |||
<syntaxhighlight lang=bash> | |||
mountpoint=/media/wilbert/Data | |||
device=$( mount -l | grep $mountpoint | cut -d' ' -f1 ) | |||
echo $device | |||
sudo umount $mountpoint | |||
sudo ntfsfix $device | |||
sudo mount $mountpoint | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Latest revision as of 08:33, 7 April 2023
Mounting an external disk you would also use with Windows 8, 10 or newer you might get an error that looks somewhat like this:
Ubuntu error The NTFS partition is in an unsafe state Error mounting /dev/sdXN Exited with non-zero exit status 14 The disk contains an unclean file system Metadata kept in Windows cache, refused to mount
From terminal
Find your device name (here referred to as sdXN)
lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL | grep -e sd
Try re-mount from the terminal:
device=/dev/sdXN mountpoint=/media/wilbert/Data #un-mount sudo umount $device #mount read/write sudo mount -t ntfs-3g -o rw $device $mountpoint
Possible result:
The disk contains an unclean file system (0, 0). Metadata kept in Windows cache, refused to mount. Falling back to readonly mount because the NTFS partition is in an unsafe state. Please resume and shutdown Windows fully (no hibernation or fast restarting.)
Note: to view the files on the mounted device with Nautilus, all instances need to be closed first
Fix
The reason for this might be the Windows hibernation feature. When you shutdown Windows, the services are not stopped but instead are hibernated and pick up were they left the on the next boot. Only when you choose 'restart' everything is really stopped. Apparently there is also some speed to be gained by leaving your disks in a mess. If you are sure to have disabled this, note that with updates it might be turned on again without asking you.
You could disable the hibernation feature in Windows:
- Control Panel
- Hardware and Sound
- Power Options
- System Setting
- Uncheck "Turn on fast startup"
You could clean-up the NTFS partition from within Ubuntu:
Install Linux NTFS tools:
sudo apt-get install ntfs-3g
Fix:
device=/dev/sdXN mountpoint=/media/wilbert/Data #un-mount sudo umount $device #fix sudo ntfsfix $device #mount read/write sudo mount -t ntfs-3g -o rw $device $mountpoint
Snippets
Show who and what is using the device
mountpoint=/media/wilbert/Data device=$( mount -l | grep $mountpoint | cut -d' ' -f1 ) echo $device sudo fuser -v -m $device
Cleanup
mountpoint=/media/wilbert/Data device=$( mount -l | grep $mountpoint | cut -d' ' -f1 ) echo $device sudo umount $mountpoint sudo ntfsfix $device sudo mount $mountpoint