Ubuntu – Auto-Mount SD-card formatted as ext4 on ubuntu touch

automountchrootsd cardubuntu-touch

I try to use an MicroSD card containing a chroot environment which I can break, e.g. by installing software, without damaging the OS on my bq Aquaris E4.5 Ubuntu Edition, however I can not let the filesystem being auto-mounted and use the chroot at the same time.

  • ext4 and similiar filesystems do not get mounted by ciborium → by default the sd card is not mounted when using ext4, an error is indicated and I am asked to format the disk as vfat
  • vfat does not support the execute permission → I cannot run programs of the chroot when the chroot is saved on a vfat partition
  • To me there is no known way to start a script automatically on startup (I have found this while searching for an answer) without changing the file-system which is by default intentionally mounted as read-only → I can not easily create a mount script executed on startup

So I wonder whether there is a way to auto-mount an MicroSD-card which can be used to store an chroot without modifying the write-protected parts of the phone.

Best Answer

I have ext2 partition on my sd card and I want automount for this partition. Here is my solution for Ubuntu Touch BQ Aquaris m10.

At first, we make a system partition writable:

sudo touch /userdata/.writable_image

After doing this system will reboot. Then, we edit /lib/init/fstab:

sudo nano /lib/init/fstab

and add this string in bottom:

/dev/mmcblk1p2  /home/phablet/mnt/sd      ext2            defaults,noatime,nodiratime,errors=remount-ro 0 2

Then, we make system partition read-only again:

sudo rm /userdata/.writable_image

And rebooting:

sudo shutdown -r now

It works!