Can I Mount A Windoze Drive?

Greg 'groggy' Lehey grog at FreeBSD.org
Sat Feb 17 07:03:06 UTC 2007


[Format recovered--see http://www.lemis.com/email/email-format.html]

Single line message.

On Saturday, 17 February 2007 at 13:46:28 +0700, Drew Jenkins wrote:

> Newbie question here. I just want to make sure I don't screw
> anything up. I have two hard drives in my box...one for Windoze, one
> for FBSD. Can I mount the former from FBSD and copy over files?

Well, you mount file systems, not disks.  But yes, using mount_ntfs
(or, if your Microsoft box is very old, mount_msdos).  In your fstab
you might have:

  /dev/ad2s2              /C:             ntfs   rw              0       0

If you now create a directory /C:, and assuming that the drive
partition is correct, this file system will be mounted automatically
when you start the system.  You can mount or unmount it manually with
'mount /C;' and 'umount /C:'.

Which disk?  Look at the device nodes in /dev:

  $ ls -l /dev/ad*
  crw-r-----  1 root  operator    4,  11 Feb  3 08:41 /dev/ad2
  crw-r-----  1 root  operator    4,  12 Feb  3 08:41 /dev/ad2s1
  crw-r-----  1 root  operator    4,  13 Feb  3 08:41 /dev/ad2s2
  crw-r-----  1 root  operator    4,  14 Feb  3 08:41 /dev/ad2s3
  crw-r-----  1 root  operator    4,  15 Feb  3 08:41 /dev/ad2s4
  crw-r-----  1 root  operator    4,  16 Feb  3 08:44 /dev/ad2s4a
  crw-r-----  1 root  operator    4,  17 Feb  3 08:42 /dev/ad2s4b
  crw-r-----  1 root  operator    4,  18 Feb  3 08:41 /dev/ad2s4c
  crw-r-----  1 root  operator    4,  19 Feb  3 08:42 /dev/ad2s4d

The node names ending in letters are BSD partitions; ad2 is the whole
drive one of the others is the Microsoft partition.  fdisk will tell
you which one:

  $ fdisk ad2
  Information from DOS bootblock is:
  The data for partition 1 is:
  sysid 6 (0x06),(Primary 'big' DOS (>= 32MB))
  The data for partition 2 is:
  sysid 7 (0x07),(OS/2 HPFS, NTFS, QNX-2 (16 bit) or Advanced UNIX)
  The data for partition 3 is:
  sysid 219 (0xdb),(CP/M, Concurrent CP/M, Concurrent DOS or CTOS)
  The data for partition 4 is:
  sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)

I've removed unnecessary output from this example.

> Do I navigate it just like a FBSD disk..."cd", "cp", etc?

In principle, yes.  Microsoft has this stupid idea of embedding spaces
in file names.  You'll see how stupid this is when you have to
navigate them using UNIX commands:

  $ ls -l /C:/WINDOWS
  ...
  drwxr-xr-x  0 yana  home        0 Dec  9  2004 Connection Wizard
  ...
  drwxr-xr-x  0 yana  home        0 Dec  9  2004 Driver Cache
  $ cd /C:/WINDOWS/Connection Wizard
  bash: cd: /C:/WINDOWS/Connection: No such file or directory
  $ cd '/C:/WINDOWS/Connection Wizard'
  $

This will work if you haven't redefined cd as a macro, like I have
done.  When I try this, I still get the error message.  This problem
will bite you everywhere you go.  You can minimize it by not using
spaces in file names yourself, but you'll constantly have problems
with it otherwise.

Greg
--
When replying to this message, please copy the original recipients.
If you don't, I may ignore the reply or reply to the original recipients.
For more information, see http://www.lemis.com/questions.html
See complete headers for address and phone numbers.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20070217/e93506b6/attachment.pgp


More information about the freebsd-questions mailing list