Menu

Main Menu
Talk Get Daily Search

Member's Online

    User Name
    Password

    Crazy mounting **** all over the place!!!!

    Reply
    vi_ | # 1 | 2011-12-02, 10:23 | Report

    Frustrated by the use of the sh|ttifying FAT32 FS on MyDocs and the stupid way it allocates space I decided I wanted to move 'maps' folder to /opt so it could nestle down in a 'real' FS.

    The only problem is you cannot symlink (derp) on a fat32. Creating a FS image seemed like to much of of a kludge (besides fat32 doesn't allow sparse files (herp)). Further to this when you plug in USB and mass storage mode everything gets unmounted (herp derp).

    Fortunately with nix you can mount pretty much anything, anywhere!


    MyDocs partition is mounted and unmounted by two scripts when you enable/disable mass storage mode. They are:

    Code:
    /usr/sbin/osso-mmc-mount.sh
    Code:
    /usr/sbin/osso-mmc-umount.sh
    So I created a directory /opt/maps_oso and copied the contents of ../MyDocs/.maps to it. Then in osso-mmc-mount.sh I added the line:
    Code:
    mount --bind /home/opt/maps_osm /home/user/MyDocs/.maps
    After line 72.

    I also had to include:
    Code:
    ##unmount extra stuff
      umount /home/opt/maps_osm
      sleep 2
    ##
    after line 32 in osso-mmc-umount.sh.


    While this is very specific to my case it may be useful for other people who want to have things automatically mounted/unmounted/linked to the exported MyDocs partition.

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following 5 Users Say Thank You to vi_ For This Useful Post:
    fw190, peterleinchen, reinob, spanner, strange1712

     
    juhanima | # 2 | 2011-12-02, 23:14 | Report

    Huh? Seems clever. Did you notice this:

    $ df
    /home/opt 2064208 (1-k blocks)
    /home/user/MyDocs 28312128 (1-k blocks)

    Other than that kudos for you for promoting the DIY philosophy!

    Edit | Forward | Quote | Quick Reply | Thanks

     
    spanner | # 3 | 2011-12-02, 23:33 | Report

    Originally Posted by juhanima View Post
    Huh? Seems clever. Did you notice this:
    $ df
    /home/opt 2064208 (1-k blocks)
    /home/user/MyDocs 28312128 (1-k blocks)
    The blocks are not actually 1KB on the DOS filesystem (I think that's just how df is displaying the free space). Create a new 1-byte file and you'll see 64 '1k blocks' disappear.

    Thanks vi_, I wondered about this a lot & when my SD card gets full I'll come back to this post.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    peterleinchen | # 4 | 2011-12-03, 00:10 | Report

    Hey vi_,

    thanks for pointing
    But wouldn't it make more sense to mount/umount in the scripts
    /usr/sbin/osso-usb-mass-storage-enable.sh (early)
    /usr/sbin/osso-usb-mass-storage-disable.sh (late) ?
    Did not check those (too tired now). Maybe tomorrow.

    Question:
    Indeed I have the problem of not getting unmounted MyDocs when enabling mass storage.
    But I do not see the reference to my maps storage file. Even if I umount it in advance, I have this problem.
    I get around when I enter
    Code:
    umount -l MyDocs
    before using mass storage mode.
    Any ideas?

    Edit | Forward | Quote | Quick Reply | Thanks

     
    vi_ | # 5 | 2011-12-19, 14:48 | Report

    Originally Posted by peterleinchen View Post
    Hey vi_,

    thanks for pointing
    But wouldn't it make more sense to mount/umount in the scripts
    /usr/sbin/osso-usb-mass-storage-enable.sh (early)
    /usr/sbin/osso-usb-mass-storage-disable.sh (late) ?
    Did not check those (too tired now). Maybe tomorrow.

    Question:
    Indeed I have the problem of not getting unmounted MyDocs when enabling mass storage.
    But I do not see the reference to my maps storage file. Even if I umount it in advance, I have this problem.
    I get around when I enter
    Code:
    umount -l MyDocs
    before using mass storage mode.
    Any ideas?
    Ay? wut?

    osso-mmc-umount.sh is called to unmount MyDocs when you choose 'mass storage' mode. If you look in osso-mmc-umount.sh you will see it goes through about 4 diffent methods of unmounting (starting nicely, ending up rather brutally) only using the next one if the previous has failed.

    In my change to osso-mmc-umount.sh I told it to specifically unmount a thing I had mounted then wait 2 seconds. After that it goes about its unmounting business as normal.

    If your Mydocs is not unmounting with osso-mmc-umount.sh AND you have already unmounted your image then something else is holding it open. You sure you are not doing something dumb like leaving your terminal in a directory in MyDocs?

    Edit | Forward | Quote | Quick Reply | Thanks

     
    peterleinchen | # 6 | 2011-12-20, 17:08 | Report

    Originally Posted by vi_ View Post
    Ay? wut?
    Ay! Yep!
    It is like that. Even if I plug in USB and mass storage mode should be enabled (calling osso-mm-umount), the MyDocs keeps mounted, so not accesible from PC.

    I have investigated and it is definitely the loop mount of the image file.
    I have booted with the entry in fstab automatically generated. But not mounted the image. This way enaböing USB works and MyDocs gets unmounted.
    Once I mount the image file (creating /dev/loop0), the umount of MyDocs does not work anymore. Even if I umount the image file (/dev/loop0) in advance.

    Only solution is 'umount MyDocs -l' manually.
    This is lazy unmounting, also referenced in osso-mmc-umount, but not called.

    I know how to workaround, but would like to know the reason (and correct solution).

    Cheers.

    --edit
    Originally Posted by vi_ View Post
    You sure you are not doing something dumb like leaving your terminal in a directory in MyDocs?
    Ay. Yes. I am sure. Also checked with lsof (nothing open) and fuser (do not know if output is correct).
    And this behaviour I normally know only from Windoof (and/or DOS) ...

    Edit | Forward | Quote | Quick Reply | Thanks

    Last edited by peterleinchen; 2011-12-20 at 17:13.

     
    sup | # 7 | 2011-12-20, 17:12 | Report

    Originally Posted by peterleinchen View Post
    Ay! Yep!
    Only solution is 'umount MyDocs -l' manually.
    This is lazy unmounting, also referenced in osso-mmc-umount, but not called.

    I know how to workaround, but would like to know the reason (and correct solution).

    Cheers.

    --edit

    Ay. Yes. I am sure. Also checked with lsof (nothing open) and fuser (do not know if output is correct).
    Yeah, me too. I also have to call umount -l often.

    Edit | Forward | Quote | Quick Reply | Thanks

     
vBulletin® Version 3.8.8
Normal Logout