Ubuntu 13.04 is unable to mount a disk drive from ex-windows system [duplicate]

Solution 1:

This is the crucial part in your message ...

  • "The disk contains an unclean file system"
  • "The NTFS partition is in an unsafe state"

Remember... windows discs need to be checked for filesystem problems.

You can try to fix this from Ubuntu with ntfsprogs. If not installed ...

sudo apt-get install ntfsprogs

and this will try to clean the disc ...

sudo ntfsfix /dev/sda3

ntfsfix is a utility that fixes some common NTFS problems. ntfsfix is NOT a Linux version of chkdsk. It only repairs some fundamental NTFS inconsistencies, resets the NTFS journal file and schedules an NTFS consistency check for the first boot into Windows.

You may run ntfsfix on an NTFS volume if you think it was damaged by Windows or some other way and it cannot be mounted.

  • You can also follow the last remark: mount the disc in readonly. You can then extract the contents to another disc.
  • If the disc do not have anything important you can also format them and ditch ntfs altogether.

I also found this on the ntfs-3g page and is probably important too since it has the exact same message (caveat: the solution requires a working Windows 8...):

"Metadata kept in Windows cache, refused to mount"

When dual booting with Windows 8, trying to mount a partition that is visible to Windows may yield the following error:

 The disk contains an unclean file system (0, 0).
 Metadata kept in Windows cache, refused to mount.
 Failed to mount '/dev/sdc1': Operation not permitted
 The NTFS partition is in an unsafe state. Please resume and shutdown
 Windows fully (no hibernation or fast restarting), or mount the volume
 read-only with the 'ro' mount option.

The problem is due to the new Windows 8 feature called "fast startup". When fast startup is enabled, part of the metadata of all mounted partitions are restored to the state they were at the previous closing down. As a consequence, changes made on Linux may be lost. This can happen on any partition of an internal disk when leaving Windows 8 by selecting "Shut down" or "Hibernate". Leaving Windows 8 by selecting "Restart", however, is apparently safe.

To enable writing to the partitions on other operating systems, be sure the fast restarting of Windows 8 is disabled. This can be achieved by issuing as an administrator the command:

 powercfg /h off

You can check the current settings on Control Panel > Hardware and Sound > Power Options > System Setting > Choose what the power buttons do. The box "Turn on fast startup" should either be disabled or missing.

Best course of action: re-install Windows 8. Fix the problem with the disc. Install Ubuntu.

Solution 2:

First, don't worry about your swap partition; it's used as an adjunct to RAM and is not meant to be mounted like most partitions. Thus, the fact that it doesn't show up in your file manager is not a problem.

Second, you should not use NTFS on a Linux-only computer. What Rinzwind posted is partially correct, in that recent versions of Windows don't completely shut down their filesystems on system shutdown or reboot and so aren't very multiboot-friendly. Rinzwind is overly optimistic about the ntfsfix program, though; it only does the simplest checks and then flags the filesystem for further checks in Windows. Since your filesystem is in an inconsistent state, this won't help at all; you must check the filesystem in Windows before you can mount it again. The need for such checks is one reason that using NTFS on a Linux-only system is not a good idea. Broadly speaking, you have two options:

  • Obtain a Windows recovery disc, boot from it, and tell it to repair the errant filesystem. Such discs are readily available on the Internet; here is one link, although I can't promise that they'll work for you, especially since the link provides Vista and Windows 7 repair discs, and you said the computer started life with Windows 8. If you have problems, try a Web search to locate a newer repair disc.
  • Physically move your disk from the current computer to another one that runs Windows, and use that Windows installation to repair the problem filesystem.

In either case, be cautious about which partition you repair; you do not want to set Windows loose on your Linux partition. Thanks to a poor choice of filesystem type code on GPT disks, this could happen; Windows will see your Linux partition as an unformatted one, and so might try to "fix" it, in the process trashing your Linux installation. I therefore recommend using gdisk to change the type code of your Linux partition from 0700 to 8300. See my Web page on this topic for more information about this.

Once you're done, I strongly recommend you back up your NTFS volume, convert it to a Linux-native filesystem (ext3/4fs, ReiserFS, XFS, JFS, or Btrfs), and restore the files. This way, you'll be able to perform filesystem repairs using Linux-native tools. The filesystem will also perform better; the NTFS-3g drivers that Ubuntu uses are sluggish compared to either Windows' own NTFS support or Linux drivers for its native filesystems.