OS-sw ver.: CCBot/2.0 (https://commoncrawl.org/faq/)
Login date: 24 Apr 19 - 10:51:35
IP Address: 3.84.182.112Cursore

Registrati
L'utilità di usare un mount personalizzato è che così possiamo salvare parte dei nostri dati, anche quelli più sostanziosi in una memoria sd inserita nello slot del telefonino.
Per fare ciò abbiamo bisogno di "montare" le cartelle che vogliamo siano trasferite su sd automaticamente al boot.

---------------------------------------------------------------------------------
Prerequisiti
---------------------------------------------------------------------------------


1. una card sd partizionata
2. la prima partizione dev'essere formattata con un filesystem linux (ext2-3-4...)
3. il filesystem linux nella root deve contenere le dir .nemo e .android

---------------------------------------------------------------------------------
Procedura
---------------------------------------------------------------------------------



Quindi seguendo un esempio che ho trovato in internet andiamo a creare i vari file per il sysctl.

Prima cosa lo script di mount.

/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


Poi il file per il systemd

/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


e lo abilitiamo da shell:


systemctl enable mount-custom.service



modifichiamo infine il file per i mount di android.

/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


---------------------------------------------------------------------------------
Verifiche finali
---------------------------------------------------------------------------------



Se tutto funziona, con un reboot dovreste vedere con un df le dir correttamente montate:

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

Visite totali67087
Questo sito web usa i cookies per gestire alcune funzionalità, quali navigazione, autenticazione, commenti, etc. Utilizzando il nostro sito web, accetti l'utilizzo dei cookies.