Linux 写下;档案;到只读系统并读取它们

Linux 写下;档案;到只读系统并读取它们,linux,raspberry-pi,Linux,Raspberry Pi,我有Raspbian(raspberry pi),我这样做是为了使其只读: dphys-swapfile swapoff dphys-swapfile uninstall update-rc.d dphys-swapfile disable aptitude install unionfs-fuse nano /usr/local/bin/mount_unionfs: [ -z "$1" ] && exit 1 || DIR=$1 ROOT_MOUNT=$(grep -v "

我有Raspbian(raspberry pi),我这样做是为了使其只读:

dphys-swapfile swapoff
dphys-swapfile uninstall
update-rc.d dphys-swapfile disable

aptitude install unionfs-fuse

nano /usr/local/bin/mount_unionfs:
[ -z "$1" ] && exit 1 || DIR=$1
ROOT_MOUNT=$(grep -v "^#" /etc/fstab | awk '$2=="/" {print substr($4,1,2)}')
if [ "$ROOT_MOUNT" != "ro" ]; then
/bin/mount --bind ${DIR}_org ${DIR}
else
/bin/mount -t tmpfs ramdisk ${DIR}_rw
/usr/bin/unionfs-fuse -o cow,allow_other,suid,dev,nonempty ${DIR}_rw=RW:${DIR}_org=RO ${DIR}
fi

chmod +x /usr/local/bin/mount_unionfs


Update fstab to look like this:
proc            /proc           proc    defaults          0       0
/dev/mmcblk0p1  /boot           vfat    ro                0       2
/dev/mmcblk0p2  /               ext4    ro,noatime        0       1
mount_unionfs   /etc            fuse    defaults          0       0
mount_unionfs   /var            fuse    defaults          0       0
none            /tmp            tmpfs   defaults          0       0

cp -al /etc /etc_org
mv /var /var_org
mkdir /etc_rw
mkdir /var /var_rw
reboot
现在,我需要做的是:我让apache运行,有时我需要将png文件作为普通文件(我认为是在内存中)存储到临时内存中,然后在php脚本中显示它们(供下载)。我知道当我断电时,这些文件就不见了(这没关系)。我的问题是,我不知道应该在哪里存储这些文件(路径)?
也许fstab设置对某些人来说很清楚,但我不理解fstab指令,所以请告诉我在哪里存储它以及如何访问它。

请查看Thank@JNevill!我只是想知道当我挂载一些ram路径时,访问权限是否与hdd上的dir相同(?)。它可能是您挂载它的目录的任何一个perm,因为挂载时不会有任何内容(因为它是ram)。