[1.1.9.28] Mounting SD card as home partition and android storage [answered]
Edit (Leinad): please don't change system filesand take a look here instead: http://talk.maemo.org/showthread.php?p=1486543#post1486543
(edit jolladiho) preconditions:
- your sd has a partitiontable
- your first partition has a linux filesystem
- your linux filesystem contains the folders .home and .android on root folder
I am using this script to mount my home dir and android folder to SD card /usr/sbin/mount-sd.custom.sh
#!/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/media
else
umount /data/media
umount /home/nemo
umount /mnt/sd
fi
and then mount it with /lib/systemd/system/mount-custom.service
[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
(edit jolladiho): enable the service with "systemctl enable mount-custom.service"
After this to make the fusermount work properly for android storage we have to make changes in two files for 1.1.9.28, look the lines under the "#original:" tag:
/opt/alien/system/script/alien_setup_chroot.sh:
#original: for d in bin sbin lib usr var etc tmp home vendor; do
for d in bin sbin lib usr var etc tmp vendor; do
if [ "" == "$(grep $ROOT/$d /proc/mounts)" ]; then
echo "mount $ROOT/$d"
mount --bind /$d $ROOT/$d
fi
done
#original: for d in dev sys run media; do
for d in dev sys run media home; do
if [ "" == "$(grep $ROOT/$d /proc/mounts)" ]; then
echo "mount $ROOT/$d"
if [ $d == "sys" ]; then
mount --make-private /sys/fs/cgroup
fi
mount --make-private --rbind /$d $ROOT/$d
fi
done
/usr/sbin/apkd-mount:
if [[ "$CMD" == "apkd-umount" ]]; then
/bin/umount "$MOUNTDIR"
else # apkd-mount
if [ ! -d "$MOUNTDIR" ]; then
mkdir -p "$MOUNTDIR"
fi
# On tablet and other non-btrfs devices, do homeification
DATADIR="/home/.android/data"
if [ ! -d "$DATADIR" ]; then
# On phone and btrfs devices, use /data directly
DATADIR="/data"
fi
#original: /bin/mount --bind "$DATADIR" "$MOUNTDIR"
/bin/mount --rbind "$DATADIR" "$MOUNTDIR"
fi
The "apkd-mount"is new in 1.1.9.28 and does the "data" part, that was done in older versions in "alien_setup_chroot.sh".
Now reboot your device and check with df -h that home folder and android storage is mounted to SD card:
Filesystem Size Used Avail Use% Mounted on
rootfs 14G 2,3G 11G 17% /
/dev/mmcblk0p28 14G 2,3G 11G 17% /
devtmpfs 404M 64K 404M 1% /dev
tmpfs 405M 464K 405M 1% /dev/shm
tmpfs 405M 30M 375M 8% /run
tmpfs 405M 0 405M 0% /sys/fs/cgroup
tmpfs 405M 8,0K 405M 1% /tmp
/dev/mmcblk0p19 7,9M 4,1M 3,9M 52% /drm
/dev/mmcblk0p18 64M 45M 20M 70% /firmware
/dev/mmcblk0p28 14G 2,3G 11G 17% /home
/dev/mmcblk0p25 7,9M 4,2M 3,8M 53% /persist
/dev/mmcblk0p9 48M 8,5M 39M 18% /var/systemlog
tmpfs 405M 0 405M 0% /mnt/asec
tmpfs 405M 0 405M 0% /mnt/obb
/dev/mmcblk1p1 59G 25G 31G 45% /mnt/sd
/dev/mmcblk1p1 59G 25G 31G 45% /home/nemo
/dev/mmcblk1p1 59G 25G 31G 45% /data/media
/dev/mmcblk0p28 14G 2,3G 11G 17% /opt/alien/data
/dev/mmcblk1p1 59G 25G 31G 45% /opt/alien/data/media
/dev/mmcblk0p28 14G 2,3G 11G 17% /opt/alien/bin
/dev/mmcblk0p28 14G 2,3G 11G 17% /opt/alien/sbin
/dev/mmcblk0p28 14G 2,3G 11G 17% /opt/alien/lib
/dev/mmcblk0p28 14G 2,3G 11G 17% /opt/alien/usr
/dev/mmcblk0p28 14G 2,3G 11G 17% /opt/alien/var
/dev/mmcblk0p28 14G 2,3G 11G 17% /opt/alien/etc
tmpfs 405M 8,0K 405M 1% /opt/alien/tmp
/dev/mmcblk0p28 14G 2,3G 11G 17% /opt/alien/vendor
devtmpfs 404M 64K 404M 1% /opt/alien/dev
tmpfs 405M 464K 405M 1% /opt/alien/dev/shm
tmpfs 405M 0 405M 0% /opt/alien/sys/fs/cgroup
tmpfs 405M 30M 375M 8% /opt/alien/run
/dev/mmcblk0p28 14G 2,3G 11G 17% /opt/alien/media
/dev/mmcblk0p28 14G 2,3G 11G 17% /opt/alien/home
/dev/mmcblk1p1 59G 25G 31G 45% /opt/alien/home/nemo
/dev/mmcblk0p28 14G 2,3G 11G 17% /opt/alien/system_jolla
/dev/fuse 59G 25G 31G 45% /opt/alien/home/nemo/android_storage
/dev/fuse 59G 25G 31G 45% /mnt/sd/.home/android_storage
/dev/fuse 59G 25G 31G 45% /home/nemo/android_storage
you do it at your own risk, carefuly. On mistakes you have to know, how to work with recovery mode.
This works great now. Thank you alot
I propably should mention that most of this is taken from threads:
Leinads maemo talk thread
and
Chemists thread here
hopey ( 2015-09-11 09:51:04 +0200 )editnice to read the howto and that the answer helps. A vote to the answer and mark as answered would be nice too.
jolladiho ( 2015-09-13 12:56:51 +0200 )editOf course, sorry I'm noob :)
hopey ( 2015-09-13 16:33:36 +0200 )editok, a hacking noob ;-). I am using the Jolla phone with the nemo home on sd card too and also helped in the maemo thread you mentioned above a little (alias meemorph).
jolladiho ( 2015-09-13 23:22:49 +0200 )editshould the last but one line in the first script not read:
umount /mnt/sd
instead of:
umount /mnt/media
JayBeRayBearGun ( 2015-10-05 00:41:34 +0200 )edit