Shared NTFS Partition Between Windows and Linx

Discussion in 'Desktop Operation' started by dalekleader, May 6, 2008.

  1. dalekleader

    dalekleader New Member

    Hello,

    I am running Ubuntu Hardy Heron (Released) with the following file system:

    sda3 - Linux
    sdb1 - Windows XP
    sdb2 - NTFS - Share

    I have installed Linux and VirtualBox. I took the existing Windows drive and added it to the system. VirtualBox is setup to writethrough (RAW) to Windows. I mounted sdb2 into Linux. The intent is to have a "shared" partition to access files simultaneously between Linux and Windows.

    My Quesiton:
    Why is it when I create a new file in Windows I cannot see it in Linux? Also, if I move a file in Linux the change is not reflected within Windows?
     
  2. falko

    falko Super Moderator Howtoforge Staff Moderator HowtoForge Supporter ISPConfig Developer

    That's strange. It should work without problems...
    Maybe the files are hidden (beginning with a .)?
     
  3. dalekleader

    dalekleader New Member

    No, they are not hidden. Interesting enough, since the original post I saved a file from an email in Windows to the shared partition. Again, I could not see the file from Linux. When I reboot the computer Linux can now see the file.
     
  4. mechrekt

    mechrekt New Member

    dalekleader, I've the same configuration as you... and the same problems :(
    I googled for it but nothing..

    Can anyone help us?
     
    Last edited: Aug 28, 2009
  5. bad_crow

    bad_crow New Member

    On my debian I have :
    windows (NTFS) : sda1
    data (NTFS) : sda2
    linux : sda3

    Everything is working properly.

    So I think the problem comes from Vbox, maybe the ressource is reserved by vbox so linux can't update it (quite note sure but I think it's possible).
    What happens when you quit Vbox (shutting down properly, not sleeping) ?
    If this doesn't work, what if you unmount/remount ?

    Have you tried to create a share on your windows and to access it via mount -t cifs ? Doing this, your linux would be considered as a normal remote computer and may be able to list your windows files properly.
    That's not the cleanest way but that's the one I have in mind for now.
     
  6. mechrekt

    mechrekt New Member

    - With Vbox running my xp guest I can read the ntfs data partition
    - If I create (for example) a folder in the ntfs data partition from Vbox I can see the folder in the host ubuntu system, but after some seconds.
    - If I create a folder in the ntfs data partition from the host ubuntu system, I can't see it from the Vbox.
    - When I close Vbox, the changes made from Vbox in that partition remains, but changes made from the host are lost.
     
  7. mechrekt

    mechrekt New Member

    Sorry but I didn't understand. I'm new in linux...
     
  8. bad_crow

    bad_crow New Member

    Alright, I'll try to sum this up :
    changes from Vbox are not comitted, changes from linux are effective.

    Creating a windows share is sharing a folder of windows over the network.
    From linux, to access this folder you need to use a command looking like this :
    mount -t cifs -o username="YYY" //Windows-IP-Address/share-name /mount/point

    so let's say that username is "user", windows has 192.168.0.2 IP-address and the mount point (folder where you will go to see the files in linux) is /mnt/win
    The share is named "Wshare" on the windows

    you'll have to type :
    mount -t cifs -o username="user" //192.168.0.2/Wshare /mnt/win
    then you go to the /mnt/win folder an you should see the contents of the windows Wshare folder.
    This system is totally independent from VBox, so it should work.

    To create the share on windows, I think this is un properties of a folder.
    The user name and password will be windows' ones.
     
  9. mechrekt

    mechrekt New Member

    Not exact: changes from Vbox are committed, but changes from linux are not effective.

    Thank you for these suggestion, but I have 2 questions:
    1) can I use the data partition also in native XP mode?
    2) the only way to share this data partition is running XP from Vbox?
     
    Last edited: Aug 28, 2009
  10. bad_crow

    bad_crow New Member

    As long as you have an XP running, with network card activated and share configured this will work, no matter if it is native or vi

    To connect to a windows share from another windows juste use this command in the execute menu : \\IP\share-name

    The shared folder will be accessible in XP like if it wasn't shared (the XP which host the share).

    The share is just another way to access the folder, you can still access mounting it through linux like you actually do but this will prevent conflicts because the linux will request a change, the XP will accept and execute the change so that only the XP will write even if you'll have the feeling that linux wrote the file.

    The major drawback is that the password is sent in clear over network, but since you are in a virtualised environnement you can use a host-only mode by adding another card.

    The share will act like an FTP server, maybe you are more familiar with this. you can access it over network but you can also access in local.



    I don't know why this doesn't work via linux for you, maybe you should ask directly in a VBox forum if there's any kind of lock.
     
    Last edited: Aug 28, 2009
  11. mechrekt

    mechrekt New Member

    How is it working in your case? :D
     
  12. bad_crow

    bad_crow New Member

    Simply because I haven't Vbox ;)

    I installed windows, created the data partition.
    Then I installed linux on the free space I left on purpose.
    Grub is installed in MBR.

    I installed ntfs-3g even if I think it's not necessary with new kernels.
    Then I mounted the systems on my linux :
    mkdir /mnt/windows
    mkdir /mnt/data
    mount -t ntfs-3g /dev/sda1 /mnt/windows
    mount -t ntfs-3g /dev/sda2 /mnt/data

    This worked so I setted up the fstab for /mnt/data
    I transfered all I wanted from my windows partition so I haven't to touch it now.

    My computer is mainly used as testing server, the windows is only there when some friends come and need an internet access (my server is a fully minimal debian install, this means no graphical interface at all). data is used for FTP and backup.

    So I access my windows by rebooting, I don't want to load it in VM.
     
  13. mechrekt

    mechrekt New Member

    My situation is:

    When I boot XP "native mode":
    - C: WinXP (NTFS)
    - D: Data (NTFS)
    - E: CDROM

    When I use Ubuntu "native mode":
    - sda2: Linux (ext3)
    - sda3: Data (NTFS)

    When I use XP "VBox guest mode":
    - C: WinXP (NTFS) (not to mount simultaneously in ubuntu to not corrupt data)
    - sda3 Data ntfs partition: mapped as network drive (using VBox guest additions). The disk is mapped as "D:" to keep the same path as in "XP native mode" (for applications to work).

    The problem is:
    - If I use "D:" label to map data partition in XP guest mode, when I boot XP in native mode there is a conflict because "D:" is the same label as the physical data partition and I can't use it. I must disconnect the mapped drive, reboot the sistem and use data partition correctly. :(
     
  14. bad_crow

    bad_crow New Member

    Can't you add another hard drive to Vbox and use the data as if it were a second hard drive using a raw mode or something like it to make sure data are comitted on the data partition and not on a vrtual HD ?
     
  15. mechrekt

    mechrekt New Member

    Doing this, I generate the problem at origin of this post :)
    I used the "raw access to partition" function supported by VBox:
    sudo VBoxManage internalcommands createrawvmdk -filename /media/DATA/HD13.vmdk -rawdisk /dev/sda -partitions 1,3 -mbr myBootRecord.mbr -relative -register
    This creates a file that links directly to partitions 1 and 3 (WinXP and DATA) that I can use in VBox.

    I think the problem is that I can't mount the same partition in ubuntu and simultaneously in guest XP (as raw partition).

    I've found this post that explains the problem:
    http://ubuntuforums.org/showpost.php?p=4322759&postcount=2

    So I think the only solution is to use data partition from guest mapping it as a network drive... but remains the problems mentioned before (same label problem).
     
  16. bad_crow

    bad_crow New Member

    What I meant is :
    use the 2 raw devices but do not mount them in linux
    make a share in windows and use the share on the linux
    when windows is not running and you want to access the datas, mount in linux normally but do not forget to unmount if you start the VM.
     
  17. mechrekt

    mechrekt New Member

    Perfect, I think it is a good idea!
    thank you, I'll try.
     
  18. mechrekt

    mechrekt New Member

    I must share the folder using "real" network or there is a way to connect to the guest using "VirtualBox Guest Additions"? I know that usually is the guest that connects to the host (using \\VBOXSVR\sda...) and not the inverse. :confused:
     
  19. bad_crow

    bad_crow New Member

    You can use a host-only interface in addition to your normal interface, that way this won't get out by the host network card and so won't get on the network.
    If you want to be sure that nobody use it then block it by firewall on the other card.
    by the way there is already a share in windows XP called C$ but only administrators can use it.
     
  20. mechrekt

    mechrekt New Member

    How can I link the guest from the host in this way?
    Is there something like "localhost" "vboxsvr" that I can use to connect to the guest shared folder?
     

Share This Page