Announcement

Collapse
No announcement yet.

Dual Boot Setup with custom mount script ->

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

    Dual Boot Setup with custom mount script ->

    Hello everyone!

    I'm on a Windows 10 / Kubuntu 16.04 dual-boot setup on an MSI notebook with 256 GB SSD + 1 TB normal HDD. Windows and Kubuntu are installed on the SDD while the data disc is shared between both operating systems.

    However, I do not want to disable Windows' hiberate quick boot feature. But activating it involves that the shared partitions can only be mounted as readonly devices, which is perfectly ok for me - if I need write access with Kubuntu, I can explicitly shutdown Windows via the restart button functionality which in total involves less time than always disabling the quickstart.

    Consequently I wanted a solution that dynamically mounts the shared partitions either as usual devices or as readonly if the former option is not possible. It seems not to be possible to do this via an fstab configuration, hence I wrote my own mount script containing the following code (I'm only focussing on one partition, my later described problem holds for both, data and windows partition).

    Code:
    dataUUID='...' #UUID of my data partiton
    mntData='/mnt/Data'
    options='defaults,uid=1000,umask=077'
    
    sudo mount -t ntfs -o $options UUID=$dataUUID "$mntData"
    if [ $? -ne 0 ]; then
        sudo mount -t ntfs -o $options,ro UUID=$dataUUID "$mntData"
    fi
    I integrated the script into the system boot by running 'sudo update-rc.d <script.sh> defaults' and I also added the corresponding header to the script. However, mounting this way works fine, but now I want to access for instance the pictures folder from my home folder, i.e. I would like to add the following bind statement to the script:

    Code:
    if [ ! -d '/home/<me>/Pictures' ]; then
        mkdir '/home/<me>/Pictures'
    fi
    sudo mount --bind "$mntData/Data/Pictures" '/home/<me>/Pictures'
    Doing this gives me the desired result, but unluckily if I now open Dolphin and select the data partiton on the left panel, the picture path opens itself, too, instead of the device's root path (i.e. /mnt/Data). If I now want to open the root path in Dolphin I have to manually open it. As long as there is no 'mount --bind' statement in my mount script, this effect does not occur, but obviously I want to use the binds to integrate the data directories into my home folder.

    Can someone explain me why Dolphin is messing up the things here and how I can fix this issue? I would appreciate to simply access the devices' root paths via Dolphin and not some subfolder...

    Thanks in advance!
    Last edited by Gibtnix; May 17, 2016, 10:31 AM.

    #2
    why are you not using the fstab to mount your filesystems? you can do a fallback mount of ro use the option 'errors=remount-ro' it will be easier to debug then a bunch of scripts

    edit for the pictures you can simlink the pictures folder to the mounted drives picture folder this is how i use my ssd /hdd in my desktop i mount the drive as /mnt/data then i simlinked various folders in my home to it .
    Mark Your Solved Issues [SOLVED]
    (top of thread: thread tools)

    Comment


      #3
      First of all thanks for your response!

      Well, I used fstab until Windows introduced the quick boot with Windows 8 (where I disabled it and hence, kept mounting my devices using fstab) and since I'm using Windows 10, I wanted to keep the quick boot enabled together with an automatic readonly (if necessary) mount of my partitions. I already tried different combinations of fstab options with the 'errors=remount-ro' option, the effect is always the same: Kubuntu resists to boot as soon as the readonly mount is necessary (i.e. Windows is hibernated). This was the point where I started to write my own mount script. However, always adding the 'ro' option makes the fstab solution working, but obviously I do not want an always readonly configuration.

      Besides, if you use fstab the effect will be exactly the same: As soon as you bind for instance the pictures folder into home, Dolphin will open the pictures folder instead of the partitions root directory by clicking on it in the left panel.

      I also tried to use symlinks instead of binds, but by doing this I had several problems with deleting files and I switched to the bind alternative because somebody in a forum suggested this to solve this deleting file issue. I will retry it anyway, maybe I can give a more detailed description why this is not useful at all.

      edit: I just did a short test using symlinks instead of binds; for the moment they seem to work just as the former binds, however there definitely was a problem in earlier Ubuntu versions which made me switch to binds... never mind, as long as the symlinks work (and also Dolphin does not mess them up), my problem is not really solved, but at least the symlinks seem to be a workaround. If someone knows or finds offer a solution to avoid that Dolphin messes up when bind mounts are used instead, please let me know it
      Last edited by Gibtnix; May 17, 2016, 02:27 PM.

      Comment

      Working...
      X