Solved Ideal way for winXP and BSD to share a partition?

dieselriot

Member

Reaction score: 23
Messages: 89

Hey everyone, I'm having trouble doing what's in the title and I'm not sure if I'm doing something wrong or if I have a faulty HDD. My setup is the following: FreeBSD and WinXP are both installed on the same disk, we'll call it ada0. I added a second disk, ada1, size 320GB, that'll hold files that need to be accessed from both systems. The disk is completely clean. I'm trying to use NTFS because I don't think there's a simple way to access UFS from WinXP. Since I can't find a way to create a NTFS filesystem from BSD, I partitioned and formatted the disk from XP. Here's what I did, step by step:

1. Opened XP's volume management tool. It asked if I wanted to "initialize" the disk as a "dynamic volume". I chose yes, then created a 250GB partition, leaving the rest unallocated.

2. Formatted the partition from XP's volume management tool as NTFS and copied a small file to the partition for testing purposes.

3. Mounted the filesystem inside BSD with the following command:
ntfs-3g /dev/ada1s1 /ntfs

4. Added the disk to /etc/fstab:
/dev/ada1s1 /ntfs ntfs mountprog=/usr/local/bin/ntfs-3g,late,rw 0 0

5. Copied heavy video files that were stored in an UFS partition. No problems so far, videos playing ok from BSD.

6. Rebooted into WinXP. The folder with the videos is now inacessible, it says I/O error when I try to open it, has a size of 0 bytes and cannot be deleted.

7. Rebooted into FreeBSD. The folder now acts the exact same as in WinXP, described above.

8. Rebooted into WinXP. Tried to copy a ~5GB file to the partition. Unhelpful windows errors halfway through.

9. Rebooted into FreeBSD. Tried to copy a ~9GB file to the partition. It copies the file without any problems.

10. Rebooted into WinXP. The ~9GB file I just copied is gone.

11. Rebooted into FreeBSD. The file is still gone.

That's as far as my testing went. Will try further testing along the day. If there's a better way than using NTFS, I'm all ears. I'd love to hear from someone that has a similar setup. Thanks everyone in advance for all the usually helpful advice.
 

aragats

Daemon

Reaction score: 700
Messages: 1,618

I'm not sure about WinXP, but with Win7 and Win10 I use NFS.
It's perfectly working, of course, you need to enable its support in Windows (Turn Windows features on and off -> Services for NFS).
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,037
Messages: 38,486

It's perfectly working, of course, you need to enable its support in Windows (Turn Windows features on and off -> Services for NFS).
Only available on the professional editions, not the home editions. Besides that NFS is a network file sharing protocol.

As for the original question, NTFS on WinXP is an older version, Windows XP itself isn't supported anymore, so I'm not surprised things got corrupted. The only filesystem that still works reliably between Windows and FreeBSD is FAT. But that has its own problems (max. 4GB filesize for example).
 
OP
D

dieselriot

Member

Reaction score: 23
Messages: 89

Thanks everyone for the advice. I think I'll go with splitting the disk into three partitions. NTFS, UFS, and a smaller FAT32 partition to act as a middleman between the former two.
 

Vull

Aspiring Daemon

Reaction score: 372
Messages: 645

Code:
4. Added the disk to /etc/fstab:
/dev/ada1s1  /ntfs  ntfs  mountprog=/usr/local/bin/ntfs-3g,late,rw  0  0

I suggest
Code:
/dev/ada1s1  /ntfs  ntfs  mountprog=/usr/local/bin/ntfs-3g,late,rw,failok  0  0
 
OP
D

dieselriot

Member

Reaction score: 23
Messages: 89

Now I started to think about the "dynamic volume" thing. Is it supposed to make a difference? It seems to somehow differ from the basic NTFS partition. gpart shows the partition as "ms-ldm-data" instead of "ms-basic-data".

As far as I'm concerned it's BSD style partitioning (partitions inside slices) as opposed to partitions on the plain disk, but I don't understand much more than I need to know about partitioning so I could be way off.
 

mark_j

Daemon

Reaction score: 681
Messages: 1,192

Last time I shared a computer was with FreeBSD and MS-DOS and as I recall I used mtools to access the DOS partition from FreeBSD and it worked well. Obviously it was FAT format and in those days nothing came in a filesize over 4GB; not even the disks themselves...

Ah the days of playing Commander Keen. :)
 

mark_j

Daemon

Reaction score: 681
Messages: 1,192

Now I started to think about the "dynamic volume" thing. Is it supposed to make a difference? It seems to somehow differ from the basic NTFS partition. gpart shows the partition as "ms-ldm-data" instead of "ms-basic-data".

As far as I'm concerned it's BSD style partitioning (partitions inside slices) as opposed to partitions on the plain disk, but I don't understand much more than I need to know about partitioning so I could be way off.
I think, and it's a guess, that it means it's a logical or extended partition. A type of partition probably not recognised by other OS because, well, it's Microsoft. It was to get around the 4 partition limit of MBR partitions.

As I hinted in the other post, your best bet is to go the lowest common denominator: FAT or FAT32.

Surely Windows XP can use FAT as the boot partition format. If not, create a partition for just the OS and another for your 'share' between OSs as FAT.

So:
Disk 1 Partition 1: NTFS Windows XP
Disk 1 Partition 2: FreeBSD using disklabel because it's MBR

Disk 2 Partition 1: FAT/FAT32 - your share disk.
Disk 2 Partition N: NTFS for Windows XP only
etc etc.

Then in FreeBSD put your entry/entries in /etc/fstab for mounting disk 2 (let's assume ada1) using something like:
/dev/ada1s1 /mnt msdosfs rw 0 0
 
OP
D

dieselriot

Member

Reaction score: 23
Messages: 89

Thanks everyone for the replies. I decided to avoid using exfat for the sake of simplicity/avoiding problems.

I found out there was a full 100GB of unallocated space on the primary disk I had completely forgotten about. So the NTFS partition went in there. I split the second disk into a 32GB FAT32 partition, a big UFS partition and a small 20GB of unallocated space that'll leave like that. It might come in hand if I ever want to play with another OS or something. Here's the final result:


Code:
=>       63  976773105  ada0  MBR  (466G)
         63       1985        - free -  (993K)
       2048   97656249     1  ntfs  (47G)
   97658297        583        - free -  (292K)
   97658880  107143168     2  ntfs  (51G)
  204802048  209715200     3  ntfs  (100G)
  414517248  562036736     4  freebsd  [active]  (268G)
  976553984     219184        - free -  (107M)

=>        0  562036736  ada0s4  BSD  (268G)
          0  209715200       1  freebsd-ufs  (100G)
  209715200   16777216       2  freebsd-swap  (8.0G)
  226492416  209715200       4  freebsd-ufs  (100G)
  436207616  125829120       5  freebsd-ufs  (60G)

=>       63  625140272  ada1  MBR  (298G)
         63       1985        - free -  (993K)
       2048  515899392     1  freebsd  (246G)
  515901440   67108864     2  fat32  (32G)
  583010304   42130031        - free -  (20G)

Only problem is that since fat32 doesn't support file permissions, I can't write to it as a regular user. Are there any options I can put in fstab so it's writable as a regular user, or do I need to mount it from elsewhere?
 

Zirias

Daemon

Reaction score: 1,422
Messages: 2,480

Obligatory warning: Don't use systems that are EOL. This is a huge risk. If you do anyways, isolate them!

Depending on what's the reason to still run ancient WinXP, I'd recommend to consider virtualization as an alternative. It could run in bhyve(8), or in emulators/virtualbox-ose. Then you could e.g. use net/samba413 to allow the VM access to a selected part of your host's filesystem.

(side note: the infamous "XP mode" offered in win7 used virtualization as well)
 

Zirias

Daemon

Reaction score: 1,422
Messages: 2,480

To be honest, any Windows install should be isolated. If anything to protect it from itself and Microsoft.
It's still a difference whether you have a recent and fully patched Windows or an ancient one with known vulnerabilities that will never be patched. And nota bene, Microsoft improved a lot regarding security. There's still room to improve, and I won't start talking about privacy, of course ;)
 

kpedersen

Son of Beastie

Reaction score: 2,018
Messages: 2,895

Microsoft improved a lot regarding security. There's still room to improve, and I won't start talking about privacy, of course ;)
Heh, I think this is it for me. If criminals access my install or if criminals@microsoft.com do, I am not satisfied. I still walk away feeling digitally raped.

But alas, I am sure everyone has heard all this before haha. Play safe kids. Keep those Windows boxes offline.
 

vigole

Daemon

Reaction score: 1,418
Messages: 1,243

* FAT32L problem: Windows crash probably destroys your files. Don't count on CHKDSK. I won't. Your best bet: backup FAT32L
* NTFS problem: even with a graceful! umount (FreeBSD), once in a while you'll get some errors, whike running CHKDSK. Therefore, back it up.

NFS is the only reliable alternative.
 

vigole

Daemon

Reaction score: 1,418
Messages: 1,243

Another point on NTFS. I'm not sure about status of NTFS "unsupported reparse point" on the "ntfs-3g" either -- I have not followed the topic recently.
Frankly, sharing a partition between to different OS is a nightmare!
 

Zirias

Daemon

Reaction score: 1,422
Messages: 2,480

Frankly, sharing a partition between to different OS is a nightmare!
That's why I think virtualization is almost always the better option if you have the need to run different OS' on the same machine. Network filesystems are designed for interoperability, local disk filesystems often not so much…
 
OP
D

dieselriot

Member

Reaction score: 23
Messages: 89

Please see man mount_msdosfs.
Thanks, I had overlooked the -u option.

/dev/ada1s2 /fat msdosfs late,rw,-u=user 0 0


NFS is the only reliable alternative.

Or SMB (if Samba provides it and Windows "mounts" it).

Yes, but that would require two different boxes instead of a dual-boot configuration.


* FAT32L problem: Windows crash probably destroys your files. Don't count on CHKDSK. I won't. Your best bet: backup FAT32L
* NTFS problem: even with a graceful! umount (FreeBSD), once in a while you'll get some errors, whike running CHKDSK. Therefore, back it up.

Great info. Thanks for sharing your experience. I'm gonna use FAT32 to transfer files between NTFS and UFS, so NTFS won't ever be mounted in FreeBSD and the files on the FAT32 partition will always be backed up elsewhere. So I think I'm all clear on this one.


Also, I know XP is ancient and full of security flaws. I don't usually allow it to access the internet. I do pretty much everything in FreeBSD. XP is just for old games. And TV-out. Although TV-out works in FreeBSD, quality is just not the same. I'm currently trying to tweak drm-fbsd13-kmod to fix that. Would probably be easier if I knew C, heh.
 

Zirias

Daemon

Reaction score: 1,422
Messages: 2,480

For old windows games, wine works surprisingly well! There might be (very few) exceptions to this.

As for "tv out", go get a tv set from this century (with hdmi in). Yeah, I know 😈 scnr
 
OP
D

dieselriot

Member

Reaction score: 23
Messages: 89

That's some great advice, thanks! I'll do that right away. Here's hoping I can stick this "hdmi" thing you speak of into my card's DVI-I out! I bet it'll work out great!
 

astyle

Aspiring Daemon

Reaction score: 377
Messages: 860

That's some great advice, thanks! I'll do that right away. Here's hoping I can stick this "hdmi" thing you speak of into my card's DVI-I out! I bet it'll work out great!
no, that won't work, HDMI and DVI-D have physically different plugs. Cables have TWO ends, not one. Also, HDMI is on its way out, DisplayPort is the standard at my workplace. At home, I'm still trying to hold onto HDMI, but my new 27-inch Gigabyte monitor does have a DP port.

Frankly, sharing a partition between to different OS is a nightmare!
yeah, that's SO true. I tried that in my pre-ZFS days - heck, pre-FreeBSD days. No go, the mounting requires a mount flag that is not always reliably cleared when shutting down one OS to boot into the other one. The booted OS always complained that the partition was never properly unmounted. I wasted quite a bit of time trying to make that work, and dealing with the fallout of my efforts. Just use a USB stick to move the files, or a webDAV server.
 
OP
D

dieselriot

Member

Reaction score: 23
Messages: 89

no, that won't work

Don't worry, I heard the next forum update will include "added sarcasm bbcode tag" in the changelog.


I wasted quite a bit of time trying to make that work, and dealing with the fallout of my efforts. Just use a USB stick to move the files, or a webDAV server.

Well, I think in this case the FAT32 partition is practically the same thing as a USB stick. Though the file transfers are faster.
 
Top