Announcement

Collapse
No announcement yet.

automatically mounting a windows folder to one of my linux folders need help

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    automatically mounting a windows folder to one of my linux folders need help

    I dual boot kubuntu 11.10 with windows 7 (oh dear god how i hate windows x.x) i have my fstab file setup so windows is autmoatically mounted in my /media directory. What i am attempting to do is set up a script that gets run when i login that uses mount --bind to bind the pictures and music folder in my windows partition to my /home/user/Pictures and /home/user/Music folders respectively. so far i have a script labeled .start that reads like this
    Code:
    #!/bin/bash
    #By Lance Zeligman
    echo *mypasswd* | sudo -S mount --bind /media/Users/user/Pictures /home/user/Pictures
    echo *mypasswd* | sudo -S mount --bind /media/Users/user/Music /home/user/Music
    sadly this doesnt seem to be doing the trickcould use some help here thanks

    #2
    Are you storing pictures and music in both windows and kubuntu? If not, instead of binding the directories, just delete the Pictures (and Music) folder in your home directory and create a symlink: ln -s /media/Users/user/Pictures /home/user/Pictures

    You only have to do the symlink one time for each folder and it will survive reboots. However, if you are storing pics and music in both places, then the symlink method won't work.

    Comment


      #3
      ill be storing pictures in both folders but id prefer to have the folders function as if its just one folder between distros ie i add a picture to pictures in linux and i see the picture there in windows symlinks are useful but to me its just kind of bleh to have a link sitting there in my folder

      Comment


        #4
        Three ways you can solve this:

        1) symlinks (as mentioned, easiest and the one I would recommend)
        Code:
        # Deleted the ~/Pictures and ~/Music directories after unmounting them then
        ln -s /media/Users/user/Pictures ~/Pictures
        ln -s /media/Users/user/Music ~/Music


        2) Relocate the mount points to the users directory in /etc/fstab (do you really need them mounted in /media?)
        or

        3) Set up the bind mount in /etc/fstab
        Code:
        # In /etc/fstab add
        /media/Users/user/Pictures /home/user/Pictures bind default,bind 0 0
        /media/Users/user/Music /home/user/Music bind default,bind 0 0
        Lastly, if you want to do down the script route I would suggest removing the 'echo "password" | ' and adding an entry to the sudoers file to allow you to run that script without a password then adding it to the auto start as "sudo /path/to/script". This way you don't have your password stored in plain text in a file though I would suggest one of the options above over this.

        Comment


          #5
          Originally posted by james147 View Post
          Three ways you can solve this:

          1) symlinks (as mentioned, easiest and the one I would recommend)
          Code:
          # Deleted the ~/Pictures and ~/Music directories after unmounting them then
          ln -s /media/Users/user/Pictures ~/Pictures
          ln -s /media/Users/user/Music ~/Music


          2) Relocate the mount points to the users directory in /etc/fstab (do you really need them mounted in /media?)
          or

          3) Set up the bind mount in /etc/fstab
          Code:
          # In /etc/fstab add
          /media/Users/user/Pictures /home/user/Pictures bind default,bind 0 0
          /media/Users/user/Music /home/user/Music bind default,bind 0 0
          Lastly, if you want to do down the script route I would suggest removing the 'echo "password" | ' and adding an entry to the sudoers file to allow you to run that script without a password then adding it to the auto start as "sudo /path/to/script". This way you don't have your password stored in plain text in a file though I would suggest one of the options above over this.
          Thank you for your help i ended up adding to the fstab file and it worked perfectly thank you for the help i really appreciate it! next up will be seeing if i can do this with a samba share XD

          Comment


            #6
            Originally posted by Fury View Post
            Thank you for your help i ended up adding to the fstab file and it worked perfectly thank you for the help i really appreciate it! next up will be seeing if i can do this with a samba share XD
            You can automatically mount remote shares in /etc/fstab as well,
            Code:
            [LEFT][FONT=arial]//server/share   /path_to/mount   cifs   guest,_netdev   0 0[/FONT][/LEFT]
            [FONT=arial][/FONT]

            for guest access or
            Code:
            //192.168.44.100/share   /path_to/mount   cifs   username=server_user,password=secret,_netdev   0 0
            for authenticated access

            Note the _netdev option, this delays the mounting until the network is brought up and the cifs is the type for samba shares.

            Comment

            Working...
            X