[HowTo][WIP] use real sdcard as home-partition and/or for android data
Updated for Salfish >= 1.0.4 If you had it running before and problems after the last Update (1.0.4), you only need to do step 6! First of all: this config is meant to be used with UNIX filesystems like ext4. There are also some suggestions for btrfs in this thread. I guess, it needs to be handled differently. Second: i'm not sure, how it affects speed with slow sdcards, but i'd recommend using a real fast (and big) sdcard Everything you do, you do at your own risk! I tried to write everything correct, but mistakes happen... So, here we go: x.a is always for using as home partition x.b is always for android data 1. create new folder for custom mountpoint Code:
devel-su Code:
mkdir /mnt/sd Code:
mount /dev/mmcblk1p1 /mnt/sd 3.a in the mounted sdcard create a hidden folder for home Code:
mkdir /mnt/sd/.home Code:
chown nemo:nemo /mnt/sd/.home 3.b in the mounted sdcard create a hidden folder for android Code:
mkdir /mnt/sd/.android Code:
chmod 777 /mnt/sd/.android 4. sync new folders with your existing data 4.a sync home folder Code:
rsync -a /home/nemo/ /mnt/sd/.home Code:
rsync -a /data/sdcard/ /mnt/sd/.android i would not recommend to delete folders in home-folder, just the big files of course you can also do this later, after some days of testing. 6. create out own bootscript 6.1. create a file mount-sd.custom.sh with this content: Code:
#!/bin/bash Code:
cp mount-sd.custom.sh /usr/sbin/mount-sd.custom.sh Code:
[Unit] Code:
cp mount-custom.service /lib/systemd/system/mount-custom.service Code:
df -h Code:
Filesystem Size Used Avail Use% Mounted on Q&A Why do you put android data in a hidden folder? Otherwise, my Gallery was full of map tiles. But if you like this, just remove the dot ;) Why do you put home data in a hidden folder? Otherwise, my Gallery showed every image twice. But if you like this, just remove the dot ;) |
Quote:
http://talk.maemo.org/showpost.php?p=1404380 it uses a hidden directory and unmounts it on reboot - writes cached data. |
Re: [HowTo] use sdcard for android apps
Thanks for the hint, i missed that!
I added the unmounting and also liked the idea of the hidden folder, because otherwise my gallery was full of map tiles :) so i moved all android stuff to /mnt/sdcard2/.android and adapted the script. also, i want my pictures and videos to be stored on the real sdcard, so i creadet the needed folder and added the mount (and unmounts). i will update the first post. |
Re: [HowTo] use sdcard for android apps
Quote:
|
Re: [HowTo] use real sdcard for camera, android data, etc
Leinad, can you update the first post for noobs please.
* full scrip,where to place (permissions etc) * create/not create folders manually, transfer/not transfer files, before/after script etc.. * how to run it (full command) Thanks |
Re: [HowTo] use real sdcard for camera, android data, etc
i've formated my sd card in btrfs, and maked subvolume, and mount with this script:
mount -o subvol=sdcard,compress /dev/mmcblk1 /data/sdcard/ mount -o subvol=Videos /dev/mmcblk1 /home/nemo/Videos/ mount -o subvol=Desktop /dev/mmcblk1 /home/nemo/Desktop/ mount -o subvol=Documents /dev/mmcblk1 /home/nemo/Documents/ mount -o subvol=Downloads /dev/mmcblk1 /home/nemo/Downloads/ mount -o subvol=Music /dev/mmcblk1 /home/nemo/Music/ mount -o subvol=Pictures /dev/mmcblk1 /home/nemo/Pictures/ mount -o subvol=Public /dev/mmcblk1 /home/nemo/Public/ mount -o subvol=Templates /dev/mmcblk1 /home/nemo/Templates/ |
Re: [HowTo] use real sdcard for camera, android data, etc
Noticed the problem with using run/ for transferring data to sdcard the hard way, tried moving my music to it via mtp (symlinked run/user/10000/media/sdcard so it showed up in mtp-mode). The transfer got stuck and I cancelled it. It stuck completely after that. Now the device complains that the memory is full -even after reboot- and there's nothing in my sd-card.
NEVER USE run/user/10000/media/sdcard TO TRANSFER DATA TO YOUR MICROSD. PS: It was a lot of music. EDIT: The problem isn't related to topic at hand |
Re: [HowTo] use real sdcard for camera, android data, etc
Quote:
|
Re: [HowTo] use real sdcard for camera, android data, etc
Quote:
when i / we found a "final" way to go, i will post a "noob-proof" receipe. for now, i think it's better, when only people, who are knowing what they do try this out. edit: please check out update in first post (mounting complete nemo-home-folder) and tell, what you think. can it be done this way without any problems? |
Re: [HowTo] use real sdcard for camera, android data, etc
Quote:
|
Re: [HowTo] use real sdcard for camera, android data, etc
Quote:
|
Re: [HowTo] use real sdcard for camera, android data, etc
Quote:
This is, what df -h now puts out with my configuration: Code:
[nemo@localhost ~]$ df -h edit: i don't understand, why /home/nemo and /data/sdcard are listed 2 times for example... |
Re: [HowTo] use real sdcard for camera, android data, etc
There was at least one little problem with my config:
all media (pictures, videos, documents, ...) was shown twice. my assuption was, it's because it's found in /home/nemo and in /mnt/sdcard2/home so i renamed /mnt/sdcard2/home to /mnt/sdcard2/.home and adapted the script. now everything seems to work fine again. will update first post. |
Re: [HowTo][WIP] use real sdcard as home-partition and/or for android data
Quote:
The limits you describe are correct... for the tmpfs mount itself! They will not apply to whatever you store inside the sdcard mountpoint. If you let the default mountpoint, then your changes simplify quite a lot: you just need to bind mount the Android sdcard directory, and that's about it. |
Re: [HowTo][WIP] use real sdcard as home-partition and/or for android data
Quote:
Quote:
Just to show you, what i mean, i mounted it the way you suggested and here's the output: Code:
[root@localhost nemo]# mount -o bind /run/user/100000/media/sdcard /home/nemo Code:
[root@localhost nemo]# df -h |
Re: [HowTo][WIP] use real sdcard as home-partition and/or for android data
Obviously, you need to mount the sd card ...
Also, you must mount the sdcard before creating the bind mount. Mounts don't propagate over to bind mounts by default. Alternatively, you might use --make-shared to ensure they are propagated, but this option is poorly documented. |
Re: [HowTo][WIP] use real sdcard as home-partition and/or for android data
Sorry, i'm afraid, i don't understand, what you mean...
Quote:
Code:
mount /dev/mmcblk1p1 /mnt/sdcard2 Quote:
What exactly would you do different? Could you please provide some lines of Code to show, what you mean? As i said, i'm no expert and happy for every improvement! |
Re: [HowTo][WIP] use real sdcard as home-partition and/or for android data
In the df output you attached there is no sd card mounted.
An example: If you undo your modifications, after reboot, your sdcard gets mounted to /run/user/100000/media/sdcard . Afterwards, just run: Code:
mount -o bind /run/user/100000/media/sdcard /data/sdcard To automate it all you have to do is to ensure it is done _after_ mounting the SD card. That means that either you edit the mount-sd.sh script or insert a new udev event handler. |
Re: [HowTo][WIP] use real sdcard as home-partition and/or for android data
i'm not sure, why the mount of the sdcard is missing in the output above, but it was mounted on /run/user/100000/media/sdcard
i undid all my modifications and ran Code:
mount -o bind /run/user/100000/media/sdcard /data/sdcard Code:
... i was not able to store more than 400MB on the sdcard, because the limitations of /run/user/100000/media/sdcard go over to /data/sdcard if mounted that way! |
Re: [HowTo][WIP] use real sdcard as home-partition and/or for android data
The problem is that /run/user/100000/media/sdcard is not mounted to the sdcard /dev/mmcblk1p1.
All subfolder of /run are tmpfs. This means that a mount -o bind /run/... /media/sdcard leads to that /media/sdcard points also to tmpfs. Be sure that /run/user/100000/media/sdcard is mounted with Quote:
Then, mount -o /run/user/100000/media/sdcard /data/sdcard should work correctly. On my Jolla i have access to 59G on /run/user/100000/media/sdcard and /data/sdcard/sdcard and both are pointing to /dev/mmcblk1p1. |
Re: [HowTo][WIP] use real sdcard as home-partition and/or for android data
Quote:
Quote:
You would not be able to use an SD card if your internal memory was full! Obviously, it does not work this way. Something is wrong and I suggest you carefully verify your setup. |
Re: [HowTo][WIP] use real sdcard as home-partition and/or for android data
would you mind sharing your df output after mounting everything the way you suggested?
|
Re: [HowTo][WIP] use real sdcard as home-partition and/or for android data
should look similar to this:
Code:
[root@Jolla nemo]# df -h Edit: This is the script (also posted at jollausers.com) Code:
#!/bin/bash |
Re: [HowTo][WIP] use real sdcard as home-partition and/or for android data
Well, that's really strange... i know i had this problem a week ago, but now i can't reproduce it.
I played around a lot with the configuration and also reformatted the sdcard several times with different FS, so maybe the problem was present, when the sdcard was on FAT32 (don't want to reformat for testing, because now there's a lot of data on it), ATM it's on ext4. So i guess, javispedro is right and i mixed something up, while playing around with the sdcard... so i removed my own mountpoint and use the standard mountpoint instead. Now my mount-sd.sh looks like this: Code:
#!/bin/bash Code:
[nemo@localhost ~]$ df -h i think, now it's time to rewrite first post to "noob-proof" receipe, or are there any problems with this conf? on my device, it works without problems. |
Re: [HowTo][WIP] use real sdcard as home-partition and/or for android data
Moving $HOME (/home/nemo) to the sdcard may be dangerous. First, it means your sdcard must use a UNIXy filesystem (ext4, btrfs, ...). Otherwise result is probably going to be a reboot loop.
Second, I don't know enough of systemd to know if the sdcard will be always mounted before the user stuff starts launching. But if it works for you... |
Re: [HowTo][WIP] use real sdcard as home-partition and/or for android data
Quote:
You are asking for problems: It could be, that mount-sd.sh is executed very late at startup of the device. If other processes, that are started before mount-sd.sh is done, need some files from /home/nemo, they would read the "old" files from the tempfs. At the moment, I am only using the /data/sdcard rebind for android (cite from post #2) and have some symbolic links at music, videos and pictures. I had two issues with that. 1. If I create an ambience from a picture on the sd-card, this ambience is gone after reboot. Thats why I think, the mount-sd.sh is executed too late. If I copy the picture to the picture folder (tempfs) and create the ambience, it is persistent. You should try, If an ambience if persistent with your conf. 2. I advise to use the .android subdirectory for the /data/sdcard rebind, like you did in your script. Because: I did an uninstall of the android support an all android apps. Then I did a new install of the android support. After that the /data/sdcard folder was *completly* empty. The android support deleted the hole folder, I think. I had some pictures before uninstalling and installing the androis support in that folder, but everything was gone, not only the folders of the android apps. If someone binds the root of the sdcard to /data/sdcard, do not uninstall and install android support, before you have a backup. |
Re: [HowTo][WIP] use real sdcard as home-partition and/or for android data
Quote:
are there important reasons not to use an own mountpoint? Quote:
Edit: it totally seems like the mount-sd.sh is called twice during bootup process. One time at an early stage, where the ambiance stuff works (but default mountpoint is not ready). And one time later, where the default mountpoint is ready, but it's too late for the ambiance stuff. When i add these lines at the end of the file Code:
if [ "$ACTION" = "add" ]; then Code:
[nemo@localhost ~]$ df -h Code:
if [ "$ACTION" = "add" ]; then Code:
[nemo@localhost ~]$ df -h |
Re: [HowTo][WIP] use real sdcard as home-partition and/or for android data
mine is better :D
Code:
/dev/mmcblk0p28 on / type btrfs (rw,noatime,thread_pool=4,ssd,noacl,space_cache,autodefrag) |
Re: [HowTo][WIP] use real sdcard as home-partition and/or for android data
ok, so someone here asked me how i have made all these subvolume ****, here is a exact copy of the pm i replied to:
ok, so here it goes. first, i have to say that my jolla have a problem. sd card never mounted in the default folder (/run/user/100000/media/sdcard) so, i don't know how it will works on a "correct" jolla. but whatever, i "don't think" there will be more problem. still ... second, i'm seeing a lot of misconception about btrfs. everyone is speeking about /dev/mmcblk1p1. btrfs do NOT need classical partition. everything you must heard about is just /dev/mmcblk1, NOT ....p1. so first, format it in the right way: mkfs.btrfs -f /dev/mmcblk1 yeah right, WITHOUT any p1. direct from the block ;) (the "-f" is not mandatory, it useful when you have problem because the device don't want to release it or something, whatever. try first without, if it works congrats, if you need it, use it) we could check if it is a real btfrs file system: btrfs filesystem show /dev/mmcblk1 then, you will be forced to mount the entire "disk" in a folder to create the subvolume: mkdir /mnt/microsd mount /dev/mmcblk1 /mnt/microsd/ we create can now create all the subvolume btrfs subvolume create /mnt/microsd/Desktop btrfs subvolume create /mnt/microsd/Documents btrfs subvolume create /mnt/microsd/Downloads btrfs subvolume create /mnt/microsd/Music btrfs subvolume create /mnt/microsd/Public btrfs subvolume create /mnt/microsd/Templates btrfs subvolume create /mnt/microsd/Videos btrfs subvolume create /mnt/microsd/sdcard btrfs subvolume create /mnt/microsd/Pictures to check if it's correct: btrfs subvolume list /mnt/microsd/ now, you must copy all data to the new directorys: cp -r -a -v /data/sdcard/ /mnt/microsd/sdcard cp /home/nemo/Pictures/Jolla/* /mnt/microsd/Pictures/Jolla/ cp /home/nemo/Video/Jolla/* /mnt/microsd/Videos/Jolla/ cp /home/nemo/Videos/Jolla/* /mnt/microsd/Videos/ (if you already have any music or something to those old directory: cp /home/nemo/Music/* etc ....) then, we can mount ;) as you can see, the compress argument is here. btrfs is able to compress "on the fly", and, more, if the data is incompressible, it remain the same. afterward, btrfs as a flaw, it's "compress all the volume/subvolume or nothing" that why i mantioned it only time mount -o subvol=sdcard,compress /dev/mmcblk1 /data/sdcard/ mount -o subvol=Videos /dev/mmcblk1 /home/nemo/Videos/ mount -o subvol=Desktop /dev/mmcblk1 /home/nemo/Desktop/ mount -o subvol=Documents /dev/mmcblk1 /home/nemo/Documents/ mount -o subvol=Downloads /dev/mmcblk1 /home/nemo/Downloads/ mount -o subvol=Music /dev/mmcblk1 /home/nemo/Music/ mount -o subvol=Pictures /dev/mmcblk1 /home/nemo/Pictures/ mount -o subvol=Public /dev/mmcblk1 /home/nemo/Public/ mount -o subvol=Templates /dev/mmcblk1 /home/nemo/Templates/ Voila. Pardon my bad english ;) EDIT1: there were some mistake, the green come from below, wich is ok, the blue is the true good correction. sorry again :o |
Re: [HowTo][WIP] use real sdcard as home-partition and/or for android data
Quote:
Also, if my Jolla will now automount my btrfs sdcard after these mods, a thosand thanks goes to you :D |
Re: [HowTo][WIP] use real sdcard as home-partition and/or for android data
holy mother of fkng copy pasta :eek::eek::eek::eek:
i HAVE TO CORRECT IT NOW !!!! sorry :( |
Re: [HowTo][WIP] use real sdcard as home-partition and/or for android data
Too complicated changes to script for my taste. Odd thing is that the basic changes to mount-sd.sh script, work for some and others not. I have no problems with mounting, but I still need symlinks, and yes I have tested and tried several times.
I don't use android stuff, which makes my life easier ;-) |
Re: [HowTo][WIP] use real sdcard as home-partition and/or for android data
@bob_bipbip, at least in my Jolla there'a no sdcard folder in /data/ (checked with ls -a), should I make one then, or what is it's importance in this?
|
Re: [HowTo][WIP] use real sdcard as home-partition and/or for android data
Quote:
|
Re: [HowTo][WIP] use real sdcard as home-partition and/or for android data
Ohh... yes, that's true :D so no subvolumes there then :rolleyes:
|
Re: [HowTo][WIP] use real sdcard as home-partition and/or for android data
Quote:
|
Re: [HowTo][WIP] use real sdcard as home-partition and/or for android data
Quote:
Now it should be unmounted. Make sure none of your applications use data from the sdcard before unmounting it. Note that all your data will be wiped from the sdcard after formatting. |
Re: [HowTo][WIP] use real sdcard as home-partition and/or for android data
Quote:
|
Re: [HowTo][WIP] use real sdcard as home-partition and/or for android data
Quote:
This thread is about over-complicating things to gain features such as the one mentioned in the thread title. |
Re: [HowTo][WIP] use real sdcard as home-partition and/or for android data
Quote:
Now I just learned how to open mount-sd.sh in vim and edit it. So it should look like this: Code:
mount $SDCARD $MNT -o uid=$DEF_UID,gid=$DEF_GID || mount -o relatime $SDCARD $MY_MOUNTPOINT I'm using this as a guide, seems to be relevant and work. PS: If you want to label your microsd when formatting it use the command Code:
mkfs.btrfs -L insertlabel /dev/mmcblk1 Don't know if the drive label can be altered afterwards. |
All times are GMT. The time now is 10:04. |
vBulletin® Version 3.8.8