LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   External Hard drive - read only (https://www.linuxquestions.org/questions/linux-hardware-18/external-hard-drive-read-only-4175434639/)

fkasmani 10-29-2012 11:53 AM

External Hard drive - read only
 
Hello, looks like my external drive's file system (NTFS) is corrupted as whenever I'm connecting it, it just loads as read-only. I feel the problem has been caused 'cos the USB cable seems to be cutting out power to it at times when I accidentally touch the cable. Most of the times I even get a kernel panic when I "safely remove the drive", but:

-how can I confirm that it's the file system having got corrupt and not something else?
-Is my data at risk?
-Since this is my data backup drive, gparted says I have about 130GB free - can I partition this so I have the 130GB as another filesystem and continue with backing up to the new partition?
-Is a damaged filesystem repairable without data corruption?
-(appologies if I sound crazy here, but no harm asking) Is it possible to change the filesystem of the corrupted drive/partition?

business_kid 10-29-2012 04:44 PM

fdisk operates on a drive without mounting it.

The 'read only' could be a kernel thing. Have you CONFIG_NTFS_RW=y?
The kernel .config is often in /boot
Use
mount -t ntfs-3g -o rw /dev/sd?? /somewhere

fkasmani 11-02-2012 01:02 PM

Quote:

Originally Posted by business_kid (Post 4817697)
fdisk operates on a drive without mounting it.

The 'read only' could be a kernel thing. Have you CONFIG_NTFS_RW=y?
The kernel .config is often in /boot
Use
mount -t ntfs-3g -o rw /dev/sd?? /somewhere

Thanks, 'business_kid'

I didn't find any kernel .config file in /boot but I did manage to find a .config file in /usr/src/linux-headers-3.0.0-12-generic in which there is reference to CONFIG_NTFS_RW
Here's what the file reads
Code:

CONFIG_NTFS_FS=m
# CONFIG_NTFS_DEBUG is not set
# CONFIG_NTFS_RW is not set

Surprisingly, I used to regularly backup my data to this external USB drive from my Linux Mint but suddenly once I connected it and it just showed all as 'read-only' - that was why I suspected to to be a file system corruption (knowing the power-cut isue I have).

Quote:

Originally Posted by business_kid (Post 4817697)
mount -t ntfs-3g -o rw /dev/sd?? /somewhere

Do I need to run this command? Hope it would not mess up any of the data in my drive.

masterclassic 11-02-2012 01:40 PM

Quote:

Quote:
Quote:

Originally Posted by business_kid
mount -t ntfs-3g -o rw /dev/sd?? /somewhere
Do I need to run this command? Hope it would not mess up any of the data in my drive.
Please, look at the man page for 'mount'.
The option rw means to mount the filesystem read-write.
:)

business_kid 11-03-2012 01:03 PM

The config should be in the same place as the kernel as config-<kernel-version>

Quote:

# CONFIG_NTFS_RW is not set
That looks like a kernel setting which would prevent NTFS write :-o. I have that set to 'y'

rknichols 11-03-2012 01:24 PM

The kernel's built in NTFS driver has only limited support for writes. The comment for the CONFIG_NTFS_RW option states:
Quote:

This enables the partial, but safe, write support in the NTFS driver.

The only supported operation is overwriting existing files, without changing the file length. No file or directory creation, deletion or renaming is possible. Note only non-resident files can be written to so you may find that some very small files (<500 bytes or so) cannot be written to.
Proper write support is provided by the userspace ntfs-3g driver, which does not depend on the kernel's NTFS support at all.

fkasmani 11-04-2012 07:07 AM

Quote:

Originally Posted by business_kid (Post 4821502)
The config should be in the same place as the kernel as config-<kernel-version>

does this mean there's a problem with my setup?


Quote:

Originally Posted by business_kid (Post 4821502)
That looks like a kernel setting which would prevent NTFS write :-o. I have that set to 'y'

What would I need to change it to, CONFIG_NTFS_RW=y as you previously mentioned?

I did try booting up my PC with an Ubuntu LiveCD and sure enough the external USB drive works perfectly with read/write.

business_kid 11-04-2012 11:29 AM

I would go by djnichols comments as he seems to have done more with this than I have recently.

That said, ignore the kernel stuff, and use ntfs-3g, making sure that ntfs-3g is installed. the site is
http://www.tuxera.com/community/ntfs-3g-advanced/

It's been so long I was mixing the older ntfs driver which never got writes sorted, and ntfs-3g which did.
So if you mount ntfs - it's the old (read only) driver
For read/write - use ntfs-3g

fkasmani 11-05-2012 01:32 PM

Thanks so much everyone for your help.
I installed 'ntfs-3g' and as soon as I connected my external drive, I could read/write the drive contents.

Thanks once again.


All times are GMT -5. The time now is 06:15 AM.