LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 05-04-2006, 07:49 PM   #1
songqsh
LQ Newbie
 
Registered: Feb 2006
Posts: 21

Rep: Reputation: 15
how to access NTFS partition on WIN XP from Debian linux?


I use Debian Linux 2.4.27-2-386.
I could not find NTFS partitions when I use linux.
Thanks if anybody can show me how to do.
 
Old 05-04-2006, 09:22 PM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
You have to mount drives before you can access them. If you only need read-only access for NTFS, then you can mount command with the option "-t ntfs". See "man mount" for more info on the command.

But because NTFS has not been fully reverse-engineered yet, write support for it is currently a rather dangerous option. You can easily corrupt the file system if you do.

There is another option though. There's something called Captive-NTFS, which takes the original Windows ntfs driver and puts a wrapper around it to make it work under Linux. But I believe you need to have get the driver yourself from a licensed Windows installation.

There may be other, newer options that I don't know about, but this is what I've heard works. I've never needed it myself, so I'm a little out of the loop. You can find a lot of info with a Google search or two.
 
Old 05-04-2006, 10:01 PM   #3
mrcheeks
Senior Member
 
Registered: Mar 2004
Location: far enough
Distribution: OS X 10.6.7
Posts: 1,690

Rep: Reputation: 52
Code:
mount /dev/hda1 /mnt
replace /dev/hda1 by your device
Code:
fdisk -l
 
Old 05-04-2006, 10:25 PM   #4
azurvii
LQ Newbie
 
Registered: Mar 2006
Posts: 21

Rep: Reputation: 0
I'm using Debian 2.6.16-1-686, using testing and unstable updated.
I don't know whether it would work on 2.4.x.

Through aptitude, I get all "ntfs" (but "doc" and "dev") found installed.
Edit /etc/fstab, add lines like

/dev/sda2 /mnt/sda2 ntfs defaults,ro,umask=555,nls=utf8,codepage=936 0 0

Because there is something Chinese on my disc, I need the 'nls' and 'codepage' options. Generally, you don't need the two options.

Then (don't forget mkdir first)

$sudo mount /dev/sda2

The ntfs should work now.
As David said, 'ro' prevents you from writing.
 
Old 05-05-2006, 03:55 PM   #5
songqsh
LQ Newbie
 
Registered: Feb 2006
Posts: 21

Original Poster
Rep: Reputation: 15
I followed instructions above, but still does not work.
Problem is files are accessble by root, but permission is denied as user.
I tried to use chmod, but failed. following is what i did:

---------------------------------------

First, I login as root, and added one line in /etc/fstab:

# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
/dev/hda1 /mnt/c ntfs ro,user,noauto 0 0
/dev/hda3 / ext3 defaults,errors=remount-ro 0 1
/dev/hda4 /home ext3 defaults 0 2
/dev/hdc /media/cdrom0 iso9660 ro,user,noauto 0 0
/dev/hdd /media/cdrom1 iso9660 ro,user,noauto 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto 0 0

Second, I created directory /mnt/c.
debian:/mnt# ls -al /mnt/
total 20
drwxr-xr-x 5 root root 4096 2006-05-05 12:36 .
drwxr-xr-x 21 root root 4096 2006-02-01 17:15 ..
drwxr-xr-x 2 root root 4096 2006-05-05 12:23 c
drwxr-xr-x 2 root root 4096 2006-02-19 17:55 cdrom
drwxr-xr-x 2 root root 4096 2006-05-05 12:36 d

After, I mounted /dev/hda1.
debian:/mnt# mount /dev/hda1
debian:/mnt# ls -al
total 16
drwxr-xr-x 5 root root 4096 2006-05-05 12:36 .
drwxr-xr-x 21 root root 4096 2006-02-01 17:15 ..
dr-x------ 1 root root 8192 2006-04-25 13:08 c
drwxr-xr-x 2 root root 4096 2006-02-19 17:55 cdrom
drwxr-xr-x 2 root root 4096 2006-05-05 12:36 d

Finally, we want to chmod for /mnt/c to be readable by users.
debian:/mnt# chmod 444 /mnt/c
chmod: changing permissions of `/mnt/c': Read-only file system
----------------------------
 
Old 05-05-2006, 06:01 PM   #6
divukman
Member
 
Registered: Sep 2005
Location: Split, Croatia
Distribution: Gentoo/Debian
Posts: 140
Blog Entries: 8

Rep: Reputation: 15
Add this to /etc/fstab

Code:
#ntfs particije za mountat
/dev/hdb1       /media/windows_particija        ntfs    ro,user,auto,umask=0007,gid=1000  0
#/dev/hdb1      /media/stari_disk               ntfs    ro,user,auto,umask=0007,gid=1000  0  0
where second entry is where you want ntfs partition mounted.
 
Old 05-05-2006, 07:37 PM   #7
azurvii
LQ Newbie
 
Registered: Mar 2006
Posts: 21

Rep: Reputation: 0
I found the problem also.
And I resolve it by changing the options to
Code:
'defaults,nls=utf8,umask=222,ro'
And I can access it as a user.

The 'uid' and 'gid' are also a resolution, but can only assign to one user or group at a time. (Am I right?)
I don't know whether 0007 is ok, since umasks I've seen are all 3 digits.

The umask is used to set the permissions.
And you'd better put the 'umask' before 'ro', I don't know whether the order matters.

Can anyone tell me how 'umask' really works?
Is it a mask as in programming to 'OR' the permission 777?
 
Old 05-05-2006, 09:49 PM   #8
songqsh
LQ Newbie
 
Registered: Feb 2006
Posts: 21

Original Poster
Rep: Reputation: 15
divukman,
Thanks a lot, I followed your instructions, and it works fine.
I have some more questions.
When I use fdisk -l, I get no mount infos, it is like following
Quote:
debian:/mnt# fdisk -l
debian:/mnt#
I found some errors for hda3.
I post /etc/fstab below, anybody can show me why?

Quote:
GNU nano 1.2.4 File: /etc/fstab

# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
/dev/hda1 /mnt/c ntfs ro,user,auto,umask=0007,gid=1000 0
/dev/hda3 / ext3 defaults,errors=remount-ro 0 1
/dev/hda4 /home ext3 defaults 0 2
/dev/hdc /media/cdrom0 iso9660 ro,user,noauto 0 0
/dev/hdd /media/cdrom1 iso9660 ro,user,noauto 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto 0 0
Following is /etc/mtab

Quote:
/dev/hda3 / ext3 rw,errors=remount-ro 0 0
proc /proc proc rw 0 0
devpts /dev/pts devpts rw,gid=5,mode=620 0 0
tmpfs /dev/shm tmpfs rw 0 0
/dev/hda4 /home ext3 rw 0 0
usbfs /proc/bus/usb usbfs rw 0 0
/dev/hda1 /mnt/c ntfs ro,noexec,nosuid,nodev,umask=0007,gid=1000 0 0
 
Old 05-05-2006, 10:13 PM   #9
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
As I understand it (and learned only recently myself), the umask numbers you use in the mount command are the inverse of the permissions you want to have. If you want permissions of 777, the mount command would be umask=000. Since write permission is superfluous for a read-only drive, umask=222, which translates to 555, is all you need here.

I don't know about the last digit in the example above though. Assuming it isn't a simple error, then it could be for the special permissions like the sticky bit.

And I may be wrong, but I don't think the order of the flags matters much. I've done it both ways and haven't seen any difference.
 
Old 05-05-2006, 10:26 PM   #10
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
Quote:
I found some errors for hda3.
I post /etc/fstab below, anybody can show me why?
If I'm understanding you right, you're looking at another mount option there. It says this in the man page for mount:
Quote:
errors=continue / errors=remount-ro / errors=panic

Define the behaviour when an error is encountered. (Either ignore errors and just mark the file system erroneous and continue, or remount the file system read-only, or panic and halt the system.) The default is set in the filesystem superblock, and can be changed using tune2fs(8).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can access NTFS partition in Linux but not Windows oudent Linux - General 2 12-10-2005 04:22 PM
NTFS access Linux partition unixbrain Linux - General 2 12-28-2004 08:57 AM
Cannot Access NTFS partition from linux farrooda Linux - Newbie 13 11-12-2004 09:24 AM
mounting Win XP ntfs partition on linux need help crittman Linux - Software 6 12-04-2003 10:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 07:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration