Before our actions we should have SD card with ext2/3/4 partition. In Ubuntu Touch it can be represented as /dev/mmcblk1p2 (in my case). If we want permanent mounting, we can’t use /etc/fstab/ but we can use /lib/init/fstab as I pointed in answer there. Permanent mounting of SD in Ubuntu Touch is not convenient and not stable. Sometimes, because of error in file system on ext2 partition, I had got problems with booting of Ubuntu Touch. Perhaps, shooting down of device doesn't perform dismounting correctly. So, I decided to mount SD card and to use Libertine container on it from time to time.
At first, I created new container with name sd-container as usual in internal disk space: /home/phablet/.cache/libertine-container/sd-container. Then, I mounted ext2 partition on SD with such command:
sudo mount /dev/mmcblk1p2 /home/phablet/mnt/sd -t ext2 -o defaults,noatime,nodiratime,errors=remount-ro
then I made directory /home/phablet/mnt/sd/sd-container/ and made copy of rootfs of sd-container to ext2 partition on SD:
cd /home/phablet/.cache/libertine-container/sd-container
rsync -aAXvH ./ /home/phablet/mnt/sd/sd-container/
After this preparing I made script to mount ext2 partition on SD and to bind rootfs (sdgo.sh):
#!/bin/sh
sudo mount /dev/mmcblk1p2 /home/phablet/mnt/sd -t ext2 -o defaults,noatime,nodiratime,errors=remount-ro
sudo mount --bind /home/phablet/mnt/sd/sd-container/rootfs /home/phablet/.cache/libertine-container/sd-container/rootfs
restart unity8-dash
and script to stop playng with this (sdstop.sh):
#!/bin/sh
sudo umount /home/phablet/.cache/libertine-container/sd-container/rootfs
sudo umount /dev/mmcblk1p2
restart unity8-dash
Finally, after I run sdgo.sh unity8-dash restarts, and I can see new SD-container scope and its applications under Desktop App Scope. I can run or install new applications as usual. But rootfs of this container is situated on SD card! When I want to stop I run sdstop.sh and SD-container scope disappears. And small original rootfs (hidden by this binding) remains on internal disk space without changes.
Conclusion: I have rootfs of Libertine container on SD card and possibility to switch on/off it and its scope when I want.
rootfsof particular libertine container on SD card and use it withmount --bind. And I've solved this problem. So, I'll present my answer. – Vladimir Dec 03 '16 at 09:37