Active Topics

 


Reply
Thread Tools
Posts: 1,680 | Thanked: 3,685 times | Joined on Jan 2011
#1
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.
__________________
N900: One of God's own prototypes. A high-powered mutant of some kind never even considered for mass production. Too weird to live, and too rare to die.
 

The Following 5 Users Say Thank You to vi_ For This Useful Post:
Posts: 11 | Thanked: 85 times | Joined on Jan 2010 @ Helsinki
#2
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!
 
spanner's Avatar
Posts: 253 | Thanked: 184 times | Joined on Nov 2009 @ Bristol, UK
#3
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.
 
peterleinchen's Avatar
Posts: 4,118 | Thanked: 8,901 times | Joined on Aug 2010 @ Ruhrgebiet, Germany
#4
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?
 
Posts: 1,680 | Thanked: 3,685 times | Joined on Jan 2011
#5
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?
__________________
N900: One of God's own prototypes. A high-powered mutant of some kind never even considered for mass production. Too weird to live, and too rare to die.
 
peterleinchen's Avatar
Posts: 4,118 | Thanked: 8,901 times | Joined on Aug 2010 @ Ruhrgebiet, Germany
#6
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) ...

Last edited by peterleinchen; 2011-12-20 at 17:13.
 
Posts: 197 | Thanked: 91 times | Joined on Dec 2010
#7
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.
 
Reply


 
Forum Jump


All times are GMT. The time now is 11:14.