aspose file tools*
The moose likes Linux / UNIX and the fly likes Access Windows Partition Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Access Windows Partition" Watch "Access Windows Partition" New topic
Author

Access Windows Partition

girish rateshwar
Ranch Hand

Joined: Mar 04, 2001
Posts: 99
Dear all,
I have a dual booted machine with windows nt on the other partition.
Is there any way i can access the windows partition when i boot into linux.

pls help.


Girish
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16145
    
  21

Yes. You just have tou mount it with the appropriate filesystem type. For example
mount -t vfat /dev/hda1 /mnt/msdos-c
One problem, though, I think the ntfs filesystem driver is a read-only one. Also, of course, the file protection rights won't map over perfectly, since there's 2 different security architectures involved.


Customer surveys are for companies who didn't pay proper attention to begin with.
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11481
    
  94

Tim: I think the ntfs filesystem driver is a read-only one
Actually it is slightly more dangerous. Under Windows 2000 it is read-only (although I hear rumors that later kernels than mine (2.4.18) allow writing to W2K partitions). Under Windows NT you can set a kernel option to allow writing to the NT partition. But this is very experimental, and there have been reports of people badly damaging their NT filesystem using this.
So, even if your partition appears writable when you mount it, I would recommend either treating it as a read only device (or force it to be read-only when you mount it (append option <code>-o ro</code>)) or make sure you have a good backup before you find out if you can write to it or not.
If you need to transfer files from Linux back to Windows NT but cannot because the drive is read only (or I have scared you too much), then there are tools which allow you to access your linux partition from inside Windows. This article has details on some of these tools.
Regards, Andrew


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
girish rateshwar
Ranch Hand

Joined: Mar 04, 2001
Posts: 99
Thanks a lot to u all.
is it the same way you mount a remote windows share?
[ June 14, 2003: Message edited by: girish rateshwar ]
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11481
    
  94

Hi Girish
The command for mounting a windows partition on your local computer looks very similar to how you mount a remote windows share.
As Tim mentioned, you can mount your windows partition using <code>mount -t vfat /dev/hda1 /mnt/msdos-c</code> (changing device and mount point to suit your setup).
To mount a remote Windows shared drive, your command would look similar to: <code>
mount -t smb //server/Shared /mnt/disk -o guest</code>.
You may need more options for mounting a shared drive (such as username / password / group name). Type <code>man smbmount</code> at a command prompt to find out the different options.
Regards, Andrew
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16145
    
  21

Actually, to qualify that, since the exact phrase was when I boot into Linux, once you've figured out how to use the mount commands, you can make the mount automatic at boot time by defining the additional filesystems in /etc/fstab.
The man page for smbmount is quite helpful:
man smbmount
girish rateshwar
Ranch Hand

Joined: Mar 04, 2001
Posts: 99
Well indeed thanks to u all, that now i can mount the windows partition as well as a remote smb share.
Going one step further i have tried to edit the /etc/fstab file.
But i keep getting the error message no automount points defined.
Could it be the syntax error:
The entry i made in the file is:
/dev/fd0 /mnt/floppy auto noauto/ouwner 0 0
Now this is with some help online, im not sure wat the 3 and 4th entries mean.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16145
    
  21


This mounts the Samba share named "ftp" on machine www2 at mount point /ftp. Note that I'm using a credentials file so that I can make it unreadable by general users (it has the username and password in it).
The "no automount" message may not be a problem - I don't think it applies to the way Samba is mounting. Several passes are made over /etc/fstab at different stages in the boot process. If you see the filesystem share, that's all that matters. Or at least all that matters excluding whatever find-tuning you want to do as to file protections and access rights.
girish rateshwar
Ranch Hand

Joined: Mar 04, 2001
Posts: 99
Well i have tried it a number of times.
It prompts me for the password and then, shows me the following error message:
"Access Denied" 9052
Well the scenario is that i have a windows NT server(srv-bdc-amigo) with the share name "answer". username="test" password="test"

Well could u let me know the exact syntax for mountng it?
I mounted it as follows:
mount -t smb //srv-bdc-amigo/answer /mnt/disk -o ro

Awaiting reply
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11481
    
  94

Hi Girish
When you said that you could mount it with <code>mount -t smb //srv-bdc-amigo/answer /mnt/disk -o ro</code> ... was this while you were logged in as user test? And did you get prompted for a password?
First step: try and get a command line that you can run and get everything mounted without it prompting you for username or passwords. I think the following should work:
<code>mount -t smb //srv-bdc-amigo/answer /mnt/disk -o ro,username=test,password=test</code>
The next step is to translate this into a line in /etc/fstab, and test it. If the previous command line worked, then it should work in /etc/fstab with little modification. Something like:
<code>//srv-bdc-amigo/answer /mnt/disk smb ro,username=test,password=test 0 0</code>
With this entered in /etc/fstab, you should be able to test it by running the command <code>mount /mnt/disk</code>.
If this all works, then you should find that it will mount automatically then next time you boot.
You should then look at Tim Holloway's suggestion of using a credentials file for added security.
By the way, my comments about writing to NT partitions being dangerous were only for when you mount an NTFS partition that is on your local computer. It does not apply to mounting SMB filesystems over the network, so you can mount the remote drive without the <code>ro</code> option if you like.
Regards, Andrew
[ June 18, 2003: Message edited by: Andrew Monkhouse ]
[ June 18, 2003: Message edited by: Andrew Monkhouse ]
 
 
subject: Access Windows Partition