Over a million developers have joined DZone.

Mounting A Virtual Filesystem

DZone's Guide to

Mounting A Virtual Filesystem

· ·
Free Resource
Source: Tutorials Linux opt on loopback - WebOS Internals [webos-internals.org]


# Create a directory on the USB drive portion to hold the virtual file system
mkdir /media/internal/vfs
#  Create a 1GB file (adjust size (bs*count) as needed, the minimum size should be 256MB)
dd if=/dev/zero of=/media/internal/vfs/optware.img bs=1024 count=1024k
# Create linux ext3 file system
mkfs.ext3 -F /media/internal/vfs/optware.img
# Create a temporary mount point
mkdir /tmp/opt
# Mount newly created virtual file system
mount -o loop /media/internal/vfs/optware.img  /tmp/opt
# Populate new virtual file system.
# Must be in the source directory.
cd /opt
tar cvf - . |  (cd /tmp/opt; tar xf -)
cd /
# Unmount virtual file system
umount /tmp/opt
# Unbind /var/opt from /opt
umount /opt
# If no errors, mount virtual file system on /opt
# otherwise skip
mount -o loop /media/internal/vfs/optware.img /opt
# Add the following line to /etc/fstab to automount (without the #).
# /media/internal/vfs/optware.img /opt ext3 loop,noatime 1 2
# Comment out the /var/opt entry, should be similar to next line
#/var/opt /opt bind defaults,bind 0 0
# reboot your phone, if error noted when attempting to unmount /opt
# If no errors noted with the Optware apps, 
# remove files/directories from /var/opt
rm -r /var/opt


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}