Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

In my web development work, I use Ubuntu almost exclusively. But there are occasions where I need to boot up Windows -- to check a layout in IE, to reslice a comp in Photoshop -- and I want to be able to share my entire localhost environment between the two.

Here's my current workflow:

In Ubuntu:

  • rsync the directory of the site I'm working on from /var/www to /windows/wamp/www (where /windows is the mount location of my windows NTFS partition as set in fstab).
  • rsync the mysql database from /var/lib/mysql to /windows/wamp/bin/mysql/{mysql version}/data.

Shut down, boot Windows, edit files, save, restart again. Back in Ubuntu, look for changed files and rsync back to /var/www, ignoring the permissions changes that have happened when moving the files to the NTFS partition.

I don't like keeping two copies of my entire development environment, and I don't like having to manually sync them. Ideally I'd like to copy my entire /var/www folder into the Windows partition and symlink to it, and do the same thing for my databases. But the permissions changes that happen cause no end of headaches when doing that.

So my question is two-part, I guess:

  • Is there any way of copying files from ext4 drive partitions to NTFS partitions that maintains the Unix permissions in a way that they can be synced back?

or,

  • Is there a better way of sharing the entire localhost environment between Windows and Linux partitions?
share|improve this question

2 Answers 2

Well you have a few options.

First, you can try the fsdriver

http://sourceforge.net/projects/ext2read/

I do not know how well that driver will work, but if it does I would go that route as you use primarily Ubuntu.

The other option is to mount your ntfs partiton with linux permissions. You will need to add a line in fstab similar to

UUID=12102C02102CEB83  /media/windows  ntfs-3g  auto,users,permissions  0  0

Change your uuid to your windows partition ( use sudo blkid )

Assuming that works you can use a link or mount bind (again, an entry in fstab)

/media/windows/www /var/www none defaults,bind 0 0 

The disadvantage of the second method is ubuntu is not going to debug a ntfs partition if there is a problem with the file system.

Edit: One other potential solution - Run Windows in Virtualbox (or KVM) and use a shared folder or network share (samba).

Good luck

share|improve this answer
    
Thanks. Hmm.. when I tried to install ext2read on windows last week, I thought that it gave me an error saying it wasn't compatible with Windows 7. Will try again. I also wasn't aware of the "permissions" option in fstab, I'll read up on that. –  goldenapples Dec 11 '11 at 19:10
    
As I indicated, I have not tried ext2read on Windows. Another option might be to run windows in virtualbox with a shared folder. –  bodhi.zazen Dec 11 '11 at 19:18
    
Sharing the disk will not work, a raw partition or did will: virtualbox.org/manual/ch09.html#rawdisk –  borrel Sep 6 '13 at 0:09
    
This is not the correct solution now. NTFS-3G supports User Mappings, which are a much better way and have better compatibility with Windows. Plus, it means your existing file permissions from Windows are retained :) –  Andrea Faulds Oct 28 '13 at 20:10

If the partition is being shared with ubuntu and windows, you can use ntfs-3g.usermap to create a user map file.

Assume the partition is /dev/sdXn mounted at /NTFS

1) umount the partition

sudo umount /dev/sdXn

2) run ntfs-3g.usermap (it will create a file UserMapping at current directory)

 sudo ntfs-3g.usermap /dev/sdXn

3) remount

sudo mount /dev/sdXn

4) copy UserMapping file

sudo mkdir /NTFS/.NTFS-3G
sudo cp UserMapping /NTFS.NTFS-3G/

Now everything should work. At least it worked for me in Ubuntu 11.10

share|improve this answer
    
Thanks very much for this! This is a much better solution than editing fstab, and it's the modern, non-deprecated one :) –  Andrea Faulds Oct 28 '13 at 20:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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