[TUTORIAL] Remount a CIFS share with rar2fs in an unprivileged LXC

jAston

New Member
Aug 26, 2023
7
1
3
rar2fs is useful to avoid unpacking archives and still access the content under a specified mountpoint.

rar2fs is a FUSE based file system that can mount a source RAR archive/volume
or a directory containing any number of RAR archives and read the contents as
regular files on-the-fly. Non-archived files located in the source directory
are handled transparently.

There might be two approaches: Having rar2fs running on the PVE host and forward the mounted filesystem as a storage to the LXC or mount it only on the LXC, the steps given are for the direct LXC approach.
E.g. you could have created a CIFS mount /mnt/nas in the LXC with the following tutorial https://forum.proxmox.com/threads/tutorial-unprivileged-lxcs-mount-cifs-shares.101795/ and then re-mount it to /mnt/rar2fs by following this tutorial.

Sample LXC configuration
var_cpu="2"
var_ram="2048"
var_os="ubuntu"
var_version="22.04"

Software used
- PVE 8.0.4
- rar2fs v1.29.6
- UnRAR source v6.2.10

Any source directory with archived content is needed, e.g. /mnt/nas


Steps​


- Login to LXC, authenticate as root user

- Install following packages for being able to compile & use rar2fs, the first three can be uninstalled after successful installation I guess.
apt install gcc apt install g++ apt install autoconf apt install libfuse-dev

- Compile & install rar2fs with the portable unrar source code
mkdir /mnt/rar2fs cd ~ wget https://github.com/hasse69/rar2fs/releases/download/v1.29.6/rar2fs-1.29.6.tar.gz tar xfvz rar2fs-1.29.6.tar.gz cd rar2fs-1.29.6 wget https://www.rarlab.com/rar/unrarsrc-6.2.10.tar.gz tar xfvz unrarsrc-6.2.10.tar.gz cd unrarsrc-6.2.10 make lib make install-lib cd .. autoreconf -f -i ./configure make make install

Mount the src dir to the target dir, usually you might want other users on the LXC have access to the share, if not drop the option '-o allow_other'
rar2fs /mnt/nas /mnt/rar2fs -o allow_other

Access /mnt/rar2fs and enjoy unarchived content.

unmount
fusermount -u /mnt/rar2fs



Sources / Links
https://github.com/hasse69/rar2fs/wiki
https://forum.proxmox.com/threads/tutorial-unprivileged-lxcs-mount-cifs-shares.101795/
https://www.rarlab.com/rar_add.htm
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!