My brother's old laptop died and I got to keep its hard-drive. Being a Windows machine, it had a bunch of NTFS partitions. So this post explains how to identify a NTFS partition, mount it as read-only and finally learn how to mount it in write mode. I should mention that FreeBSD 7.4 was used but the same steps should apply to latter versions of the OS.
Physically attached the hard-drive (in my case I plugged an USB HDD) and have a look at /var/log/messages to identify the harddrive.
# tail -n 20 /var/log/messagesJan 26 21:40:03 flumen kernel: da0:
Fixed Direct Access SCSI-4 deviceJan 26 21:40:03 flumen kernel: da0: 40.000MB/s transfersJan 26 21:40:03 flumen kernel: da0: 114473MB (234441648 512 byte sectors: 255H 63S/T 14593C)
Similar information can be collected from dmesg.
on uhub4da0 at umass-sim0 bus 0 target 0 lun 0da0: Fixed Direct Access SCSI-4 deviceda0: 40.000MB/s transfersda0: 114473MB (234441648 512 byte sectors: 255H 63S/T 14593C)
Let's find out which is the NTFS partition:
# fdisk /dev/da0******* Working on device /dev/da0 *******parameters extracted from in-core disklabel are:cylinders=14593 heads=255 sectors/track=63 (16065 blks/cyl)Figures below won't work with BIOS for partitions not in cyl 1parameters to be used for BIOS calculations are:cylinders=14593 heads=255 sectors/track=63 (16065 blks/cyl)Media sector size is 512Warning: BIOS sector numbering starts with sector 1Information from DOS bootblock is:The data for partition 1 is:sysid 18 (0x12),(Compaq diagnostics)start 63, size 16611147 (8110 Meg), flag 0beg: cyl 0/ head 1/ sector 1;end: cyl 1023/ head 254/ sector 63The data for partition 2 is:sysid 7 (0x07),(OS/2 HPFS, NTFS, QNX-2 (16 bit) or Advanced UNIX)start 16611210, size 117194175 (57223 Meg), flag 80 (active)beg: cyl 1023/ head 0/ sector 1;end: cyl 1023/ head 254/ sector 63The data for partition 3 is:sysid 15 (0x0f),(Extended DOS (LBA))start 133805385, size 100631160 (49136 Meg), flag 0beg: cyl 1023/ head 0/ sector 1;end: cyl 1023/ head 254/ sector 63The data for partition 4 is:
Issuing the following command will mount a NTFS partition in read-only mode:
# mount -t ntfs /dev/da0s2 /mnt/
To be able to write into a NTFS partition it is required to install the sysutils/fuse-ntfs port:
# cd /usr/ports/sysutils/fusefs-ntfs/ && make install clean
If you use, as described in the man page, mount -t ntfs-3g an error will occurr:
# mount -t ntfs-3g /dev/da0s2 /mnt/mount: /dev/da0s2 : Operation not supported by device
To mount the NTFS partition in write mode issue:
# ntfs-3g /dev/da0s2 /mnt/
Let's make sure that the partition is mounted:
#mount/dev/ad4s1a on / (ufs, local)devfs on /dev (devfs, local)/dev/ad4s1e on /tmp (ufs, local, soft-updates)/dev/ad4s1f on /usr (ufs, local, soft-updates)/dev/ad4s1d on /var (ufs, local, soft-updates)/dev/ad5s1d on /mnt/1 (ufs, local, soft-updates)/dev/fuse0 on /mnt/2 (fusefs, local, synchronous)
man ntfs-3g contains some Linuxisms and as such read the man page with a grain of salt ;)