View Single Post
Posts: 594 | Thanked: 1,094 times | Joined on Aug 2012 @ Rhine
#1

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
2. mount sdcard to that folder (assuming you have formatted as p1)
Code:
mount /dev/mmcblk1p1 /mnt/sd
3. create folders
3.a in the mounted sdcard create a hidden folder for home
Code:
mkdir /mnt/sd/.home
Code:
chown nemo:nemo /mnt/sd/.home
(home folder should be owned by nemo)
3.b in the mounted sdcard create a hidden folder for android
Code:
mkdir /mnt/sd/.android
Code:
chmod 777 /mnt/sd/.android
(android apps need right access)

4. sync new folders with your existing data
4.a sync home folder
Code:
rsync -a /home/nemo/ /mnt/sd/.home
4.b sync android folder (if you want)
Code:
rsync -a /data/sdcard/ /mnt/sd/.android
5. at this point, you could delete the old data stored on the device. i deletet only images and videos in home + android data.
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

ACTION=$1

if [ "$ACTION" = "add" ]; then
  mount /dev/mmcblk1p1 /mnt/sd
  mount -o bind /mnt/sd/.home /home/nemo
  mount -o bind /mnt/sd/.android /data/sdcard
else
  umount /data/sdcard
  umount /home/nemo
  umount /mnt/sd
fi
and move it to /usr/sbin
Code:
cp mount-sd.custom.sh /usr/sbin/mount-sd.custom.sh
chown root:root /usr/sbin/mount-sd.custom.sh
chmod +x /usr/sbin/mount-sd.custom.sh
6.2. create a file mount-custom.service with this content:
Code:
[Unit]
Description=Handle custom sdcard
After=local-fs.target
RequiresMountsFor=/home

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/sbin/mount-sd.custom.sh add
ExecStop=/usr/sbin/mount-sd.custom.sh remove

[Install]
WantedBy=multi-user.target
and move it to /lib/systemd/system
Code:
cp mount-custom.service /lib/systemd/system/mount-custom.service
chown root:root /lib/systemd/system/mount-custom.service
systemctl enable mount-custom.service
7. reboot your device and check, if everything is working as expected
Code:
df -h
should show something like this:
Code:
Filesystem            Size  Used Avail Use% Mounted on
rootfs                 14G  1.9G   12G  15% /
/dev/mmcblk0p28        14G  1.9G   12G  15% /
devtmpfs              406M   64K  406M   1% /dev
tmpfs                 407M  360K  406M   1% /dev/shm
tmpfs                 407M   28M  380M   7% /run
tmpfs                 407M     0  407M   0% /sys/fs/cgroup
tmpfs                 407M   20K  407M   1% /tmp
/dev/mmcblk0p19       8.0M  4.1M  3.9M  52% /drm
/dev/mmcblk0p9         48M  9.2M   39M  20% /var/systemlog
/dev/mmcblk0p28        14G  1.9G   12G  15% /swap
/dev/mmcblk0p28        14G  1.9G   12G  15% /home
/dev/mmcblk0p25       8.0M  4.2M  3.8M  54% /persist
/dev/mmcblk0p18        64M   45M   20M  70% /firmware
tmpfs                 407M     0  407M   0% /mnt/asec
tmpfs                 407M     0  407M   0% /mnt/obb
/dev/mmcblk1p1         60G  8.3G   49G  15% /mnt/sd
/dev/mmcblk1p1         60G  8.3G   49G  15% /home/nemo
/dev/mmcblk1p1         60G  8.3G   49G  15% /data/sdcard
/dev/mmcblk1p1         60G  8.3G   49G  15% /media/sdcard/4582345364s...

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

Last edited by Leinad; 2014-04-04 at 15:49.
 

The Following 16 Users Say Thank You to Leinad For This Useful Post: