You are not logged in.

#1 2013-06-25 15:45:42

drag0nius
Member
Registered: 2013-04-20
Posts: 6

unionfs-fuse as filesystem root

I currently have Arch booted over iscsi, i want to use it in read-only mode (so multiple users can use it simultaneously) with read-write unionfs stored in RAM (tmpfs).

Currently i have this script:

#!/bin/sh

# Copyright: Bernd Schubert <bernd.schubert@fastmail.fm>
# BSD license, see LICENSE file for details

FUSE_OPT="-o allow_other,use_ino,suid,dev,nonempty"
CHROOT_PATH="/.unionfs"
UNION_OPT="-ocow,chroot=$CHROOT_PATH,max_files=32768"
# 2/3 wolnego RAM'u 
TMPFS_SIZE=`free -m | grep Mem: | awk '{ printf "%d\n", $4 * 2 / 3 }'`

UBIN=/usr/bin/unionfs

mount -t proc proc /proc
# mount -t tmpfs tmpfs /tmp                                                  '`
mount -t tmpfs -o size=${TMPFS_SIZE}M,rw tmpfs /.unionfs

mkdir -p $CHROOT_PATH/root
mkdir -p $CHROOT_PATH/rw
mkdir -p $CHROOT_PATH/union

mount --bind / $CHROOT_PATH/root

$UBIN $FUSE_OPT $UNION_OPT /rw=RW:/root=RO $CHROOT_PATH/union

mount -t proc proc $CHROOT_PATH/union/proc

cd $CHROOT_PATH/union
mkdir oldroot
pivot_root . oldroot

# init q

I'm pretty sure script itself is ok (when i simply execute it in working system, everything works properly except 'pivot_root').

I have no idea how to properly invoke it during system boot with systemd.

Last edited by drag0nius (2013-06-25 16:39:29)

Offline

Board footer

Powered by FluxBB