8

Sorry if this question is already solved.

I changed my Operating System, from Windows to Linux Ubuntu 13.04.

I have 2 partitions:

  • C: (system) and
  • M: It's NTFS; there I have my information, music, photos. When I want to access the Disk to use the information, I can't get past this error:

    Error mounting /dev/sda2 at /media/love/Mis Archiivos: Command-line `mount -t "ntfs" -o "uhelper=udisks2,nodev,nosuid,uid=1000,gid=1000,dmask=0077,fmask=0177" "/dev/sda2" "/media/love/Mis Archiivos"' exited with non-zero exit status 14: 
    The disk contains an unclean file system (0, 0). 
    Metadata kept in Windows cache, refused to mount. 
    Failed to mount '/dev/sda2': 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.
    

Clarification: I don't have 2 OSes. I only have Linux installed.

1

6 Answers 6

17

You could try this (worked for me with similar problem):

  1. sudo apt-get install ntfsprogs
  2. sudo ntfsfix /dev/sdb2

That worked for me. Good luck!

5
  • When I put this code in terminal, have a lot of errors :S Another idea? May 4, 2013 at 16:23
  • 1
    @FedericoRibero What kind of errors you got? May you paste them? :) EDIT: you could try use this command first: sudo apt-get install ntfs-3g
    – shardival
    May 4, 2013 at 16:28
  • Worked for me too! Nice answer! Jul 15, 2014 at 2:50
  • hmm I get supersonic@bonuslevel:~$ sudo apt-get install ntfsprogs Reading package lists... Done Building dependency tree Reading state information... Done Package ntfsprogs is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package 'ntfsprogs' has no installation candidate
    – MetaGuru
    Feb 23, 2015 at 3:48
  • Awesome.. within seconds my driver became accessible.. I faced this problem after upgrading my window 7 to windows 10 which is in dual boot with ubuntu 14.04 Aug 8, 2015 at 5:49
3

The problem is that the disk is marked as "unclean," meaning that it was not shut down properly and may contain errors. Unfortunately, there's no Linux utility to repair such problems on NTFS volumes. The ntfsfix utility recommended by shardival repairs only the most basic errors and then schedules a full repair by Windows the next time it's booted, so it's unlikely to help.

All this means that you must boot Windows to fix the problem. I realize you say you don't have Windows installed, so this means that you must either temporarily move the disk to a computer that does have Windows installed or use a Windows emergency repair disc. This site has such disc images, and I'm sure you can find them elsewhere, too.

In the long term, converting the NTFS partition to use a Linux filesystem is the best solution, but you can't do this until you repair the NTFS volume, or at least coax Linux into mounting it. Converting the partition to use a Linux filesystem will require backing up the files to another medium, unmounting the NTFS partition, creating a new Linux filesystem on the now-NTFS volume, re-mounting that partition, and copying the files back. I realize this is a hassle, but it will prevent a recurrence of the problem you've encountered, and give you better performance, too. (NTFS is slow on a Linux system compared to most Linux filesystems.)

0

I have another idea. This worked for me, when I corrupted somehow my external HDD with NTSF partition - and quite vital files inside.

  1. sudo apt-get install testdisk -y
  2. sudo testdisk
  3. Create log file (just in case)
  4. Then find your NTFS partition
  5. Advance
  6. Hit "undelete"
  7. Backup your files somewhere on your HDD.
  8. Format NTFS partition when you check all files are OK
  9. Profit!

This should help!

0

Answer:

If you can, boot into a Windows environment (this could even include WinPE¹) and run chkdsk /f in a command prompt². If you cannot boot into Windows, see this website on how to repair anything from a corrupt NTFS partition to a broken master boot record from Ubuntu. (scroll down to the part about a corrupt NTFS partition, of course)

Appendix:

  1. Windows Preinstallation Environment: This would be booting from a Windows Vista/7/8 install disc or WinPE created disc via alternate methods. (see resources) On a Windows Vista/7/8 disc, press SHIFT+F10 after it finishes booting to open a command prompt.

  2. chkdsk /f must be ran in a command prompt with elevated (administrator) privileges.

Resources:

  1. Legal (and free) Windows 7 ISO from Digital River (Microsoft download partner)

  2. Alternate Methods of WinPE:

    • The use of these are not recommended, I suggest downloading an ISO from above

    • BartPE (Free version of Windows XP PE - requires original install disc)

    • Windows Recovery Discs (Not free - $19.75)

  3. Fix NTFS partition from Ubuntu

0
0

There isn't a fsck.ntfs in ubuntu and ntfsck doesn't fully implement ntfs.

Options:

1) If you have access to a Windows system you can connect the drive to it and run the windows file check utility (chkdsk)

2) If you have an optical drive you could obtain a boot cd and check the filesystem that way.

A couple I have used in the past with good results are:

http://www.ubcd4win.com/contents.htm

and

http://www.hiren.info/pages/bootcd

You should be able to boot off of one of those Cd's and chkdsk the drive/partition that you are having problems with.

-3

You need to format the drive to EXT4. Backup first before you do these steps.

1

Open a terminal window and log in as root:

$ su (or "sudo su" on some distributions)

2

Find out the name of your hard drive. To do this, enter the following from the command prompt as root:

# fdisk -l

3

Choose your newly installed drive after fdisk lists the current drives. The current hard drive will already have partitions assigned, and the output will look like this:

Disk /dev/sda: 16.1 GB, 16139354112 bytes
 /dev/sda1 * 1 1874 15052873+ 83 Linux

/dev/sda2 1875 1962 706860 5 Extended

/dev/sda5 1875 1962 706828+ 82 Linux swap / Solaris

4

Check to see if your disk is already mounted with this command:

# df

5

Unmount your drive if it is mounted using this command:

# umount /dev/sdb

6

Create a new partition by typing this command:

# fdisk /dev/sdb

7

The fdisk prompt will open. Press "n" to make the new partition, and then press "Enter."

8

Press "p" to create a primary partition, and then press "Enter."

9

Press "1" to create the first partition followed by "Enter."

10

Enter the default for both the first and last cylinders when your computer asks for this information. This will make the partition cover the entire disk rather than just part of it.

11

Press "t" to change the file system type followed by "Enter."

12

Type "L" to see a list of known types followed by "Enter."

13

Type "83" for "Linux" followed by "Enter."

14

Press "w" to write the partition to the disk (this cannot be undone), and then press "Enter."

Format the New Partition

15

Format the new partition that you created with the following command:

# mkfs.ext4 /dev/sdb1

16

Create a new directory and mount the new drive with these commands:

# mkdir /media/newdrive (or whatever name you prefer)

# mount /dev/sdb1 /media/newdrive

17

Edit your fstab file so that the new drive will be mounted at boot. Fstab is the Linux file system configuration file to mount partitions at boot. You can edit /etc/fstab with the "nano" command or "vi" depending on which editor you prefer.

# nano /etc/fstab or # vi /etc/fstab

18

Add the following line to the end of fstab:

/dev/sdb1 /media/newdrive ext4 defaults 1 2

19

Save the fstab file.

Hope this helps!!!

3
  • :S So, I need format for use? :/ Thanks friend.. Not the best start in Linux for me May 4, 2013 at 16:26
  • 3
    This will LOSE ALL DATA that is on the partition, which is not what the OP wants.
    – ignis
    May 4, 2013 at 18:02
  • 2nd comment above.
    – Elder Geek
    May 16, 2014 at 21:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .