1

Now I have two OS on my computer: Windows 10 and Linux (arch). Sometimes I use Linux but I also use windows because of gaming, and I want to create a small application that is going to work on both OS. I want to know if it is possible to share a Mongo database with all its collections and indexes between the two OS.

This is something I want on my computer for personal usage, it is just a small application, but it creates a lot of documents and some indexes. Also, I will be adding Indexes frequently.

I can not use any external server or machines to store the DB, because the application should work offline. I don't want to migrate the DB from one system to another every time I boot my computer using mongoexport because that takes time and recreates the indexes.

0

In theory, YES... If your mongod dbpath is at partition what both sides can read and write. So, you cannot use linux partitions (ext2,ext3,ext4,...) because your windows don't know how to handle. It's better not to use ntfs at windows side, because linux don't always handle ntfs right. So, solution is use older vfat32 partition type. Both sides can handle that well.

| improve this answer | |
  • Thanks a lot! There are any problems using ntfs besides linux using invalid names for files? – Shiro Mar 30 '18 at 16:09
  • @Shiro The Linux kernel currently only includes limited write support for NTFS. For full read/write support you need to install NTFS-3G which is a FUSE (Filesystem in Userspace) implementation. With FUSE you shouldn't expect impressive performance (although it's likely fine for a small database). I'd be wary of potential file/directory permission issues when swapping O/S and be sure to cleanly unmount the filesystem when restarting. – Stennie Apr 3 '18 at 11:47
  • 1
    I recommend creating a separate partition for shared data files and using vfat32 for best compatibility. NOTE: vfat32 has a 4GB max file size, so if your small app is likely to have individual collections larger than 4GB (compressed) you'll either need to use NTFS or configure your MongoDB server to use the MMAPv1 storage engine. The default WiredTiger storage engine (MongoDB 3.2+) uses compression, but as at MongoDB 3.6 allocates a data file per collection & index. The older MMAPv1 storage engine stores data in multiple files with a maximum of 2GB each (but does not support compression). – Stennie Apr 3 '18 at 11:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.