PDA

View Full Version : How do you mount and read ntfs partitions?



Thaidog
04-07-2004, 02:38 AM
I would like to mount and read the ntfs partitions on my computer I'm currently using knoppix with... and be able to write some files to a floppy or other media... how do I mount these directories? (from the cmd line) thx

toaster2
04-09-2004, 08:06 PM
Let's suppose your NTFS is a slave hard disk and you are logged in as root. Create a directory to /mnt/hdb1 to mount to (or any other directory name you prefer) and type in shell as root:

mount -t ntfs /dev/hdb1 /mnt/hdb1

Note: ntfs can't be written to.

toaster2
04-09-2004, 08:13 PM
Oh, I forgot. For the floppy:
mount /dev/fd0 /mnt/floppy

Check out the following file: /etc/fstab. It contains the default mount points, so you could just write "mount /dev/devicename" and the OS will take care of the missing details.

eco2geek
04-10-2004, 01:13 AM
From the "more than you wanted to know" dept, here's a link (http://linux-ntfs.sourceforge.net/info/ntfs.html) to the Linux NTFS project's FAQ. It notes that "The original driver, in [kernel] 2.4 has some write code in it, but it is extremely dangerous to use it. The possibility of destroying your filesystem is very high."

Reading data from an NTFS partition is fine, though.

So be sure to mount it read-only (e.g. by placing -o ro at the end of the mount example given earlier). <edit> Ooops, forgot the "-o" switch; the entire command is "mount -t ntfs /dev/hda1 /mnt/hda1 -o ro"; although the mount command is smart enough that you can shorten it to "mount /dev/hda1 /mnt/hda1 -o ro". </edit>

There is a Knoppix "clone" named Linux Defender Live (http://www.distrowatch.com/table.php?distribution=Linux+Defender+Live) that includes a, shall we say, novel new utility that's actually able to safely write to NTFS partitions. It's called Captive (http://www.jankratochvil.net/project/captive/), and it actually downloads, installs, and uses WinXP NTFS drivers from MS! (It has a GUI wizard to install them that's very easy to use.) Check it out. :)

Thaidog
04-10-2004, 01:59 AM
From the "more than you wanted to know" dept, here's a link (http://linux-ntfs.sourceforge.net/info/ntfs.html) to the Linux NTFS project's FAQ. It notes that "The original driver, in [kernel] 2.4 has some write code in it, but it is extremely dangerous to use it. The possibility of destroying your filesystem is very high."

Reading data from an NTFS partition is fine, though.

So be sure to mount it read-only (e.g. by placing ro at the end of the mount example given earlier).

There is a Knoppix "clone" named Linux Defender Live (http://www.distrowatch.com/table.php?distribution=Linux+Defender+Live) that includes a, shall we say, novel new utility that's actually able to safely write to NTFS partitions. It's called Captive (http://www.jankratochvil.net/project/captive/), and it actually downloads, installs, and uses WinXP NTFS drivers from MS! (It has a GUI wizard to install them that's very easy to use.) Check it out. :)

Is that the one that uses wine? I stumbled across that one the other day.

Thaidog
04-10-2004, 02:11 AM
My thing is why can we mount remote ntfs via samba and read/write to it and not do it locally? It makes little sence to me.

OErjan
04-10-2004, 12:47 PM
the remote mount uses that computers os for file manipulations.
otoh if it works with linux running on both machines im speachles, then it would be possible to make a "virtuall mount" and use that for rw access.

Durand Hicks
04-10-2004, 06:15 PM
If what Thaidog says is true, I must admit, he's got a point. Makes no sense to me if you can read/write to ntfs thru the network, and not do it locally. I used to wonder the same thing when connecting win9x computers to an NT domain network. It was always M$ contention that fat16/32 couldn't read/write to ntfs but thru the network it could. Could it be that the tcp/ip protocol is somehow enabling the read/write feature thru emulation at real time speed? If so, then why don't the developers make use of that to develop a native module that would emulate any filesystem from linux to any other filesystem thru tcp/ip without having to use a wrapper of the native proprietary code, such as ntfs?

eco2geek
04-10-2004, 10:41 PM
My thing is why can we mount remote ntfs via samba and read/write to it and not do it locally? It makes little sence to me.

That's a good question, and if you'll allow me to make a half-assed guess: From cursory inspection, it appears that the APIs for SMB over TCP/IP are built on stuff that was created by IBM back in 1984, then standardized by the IETF in 1987. Microsoft's implementation of it is pretty well documented by Microsoft itself, e.g. on MSDN (http://msdn.microsoft.com). In a nutshell, how to "do" native Windows networking is documented well enough that the Samba team could make their own Un*x implementation of it.

OTOH, how to "do" low-level NTFS read/write/etc. access is not. Microsoft tells you enough about its API so that, for example, you can write your own defrag program (on Windows); but Microsoft's not going to tell you enough about how it works at a low level so you can include native NTFS support in your favorite free OS's kernel.

With Samba you can mount NTFS volumes and read and write to them, but remember, it's the actual Windows computer that's still handling the low-level hard drive access. Samba's just "telling it what to do."

(End of half-assed guess. :wink: )

Thaidog
04-11-2004, 01:07 AM
[quote]
With Samba you can mount NTFS volumes and read and write to them, but remember, it's the actual Windows computer that's still handling the low-level hard drive access. Samba's just "telling it what to do."

(End of half-assed guess. :wink: )

Well what if you have a linux box acting as a samba server? (Am I going to get shot if I dig too deep here? :shock: ) It still makes no sense to me...

garyng
04-11-2004, 08:43 AM
[quote]
With Samba you can mount NTFS volumes and read and write to them, but remember, it's the actual Windows computer that's still handling the low-level hard drive access. Samba's just "telling it what to do."

(End of half-assed guess. :wink: )

Well what if you have a linux box acting as a samba server? (Am I going to get shot if I dig too deep here? :shock: ) It still makes no sense to me...

Samba on linux still relies on underlying fs to access NTFS and currently only read-only unless you use capture. eco2geek's referred to using the smbfs which would mount a remote server that is running Windows that can read/write NTFS.

Thaidog
04-11-2004, 10:08 AM
Hey all I know is I've got a Mac OS X box (2 actually) that use smb to share files... it's filesystem is HFS+... but the OS itself can mount FAT32 and NTFS locally and read and write to both locally. Also, I'm pretty sure I can take those disks and make them SMB shares as well. HFS+ shares under samba can be read and written to.

Now it's obvious to me that samba is nothing more than a protocol that is used by windows to xfer files over a network... and Linux can use this protocol to share local disks with XFS or whatever filesystem with read write privileges. (I don't know if you can share local ntfs shares on the box via smb...?)

The thing is that UNIX seems at least to me to treat local and remote filesystems pretty much the same... There's got to be some rather easy way to trick it in to thinking a local disk is a remote disk and use the smb protocal to access r/w priv's. It might not be the fastest way to access the files but it at least seems possible.

What I don't know is if there is some kind of "hooks" that have to be developed for the underlying filesystem to support the samba protocol. Which to me seems the only possible hangup.

garyng
04-11-2004, 10:47 AM
you don't need hook of any sort as far as samba goes. Samba is just another program running on linux and can read/write all mounted fs, limited by what the underlying fs driver can do.

This is the same for XP, or Mac or whichever as far as I know.

Now it is possible on linux to not interpret the NTFS partition but treat it as just a block device and shared it over the network(but not SMB though). Unfortunately, I don't know a Window programs that can do this over the network. So the bottom line still comes down to, if the NTFS partition is on a machine running linux, there is NO WAY to write to it safely except the captive project. Samba doesn't help here.

OErjan
04-11-2004, 02:23 PM
just as i thought, windows must run on the machine where ntfs is being written to.