How to automatically import a ZFS pool with ALTROOT?

Pickwick

New Member
Aug 6, 2024
7
1
3
Hi everyone,

I have a Proxmox setup which automatically imports the default created ZFS root pool and makes it available as /rpool. That works because a cachefile is used and there's a systemd service importing all pools part of that cachefile.

Though, I have one additional pool which I would like to place under /mnt. That works when doing so manually using a command like the following:

Code:
zpool import -R '/mnt' -o cachefile="" zpool-hdd

The problem with that approach is that it only works until the next reboot, afterwards the pool is imported automatically, because it's part of the cachefile, but it made available as `/zpool-hdd` instead of `/mnt/zpool-hdd`. It seems that the setting for ALTROOT is not part of the cachefile, looking at it with some editor I can't find that string anywhere as well. There are some hints that the cachefile really doesn't contain that info:

No. It caches the config nvlist of the pool.

https://zfsonlinux.topicbox.com/groups/zfs-discuss/T9fac2c37fac89a00

So what's the expected approach to import and mount pools somewhere?

Is one really forced to add custom scripts to CRON's @reboot or write systemd services or something? Or is there some setting available with cachefile and ALTOORT I'm simply missing yet?

Thanks!
 

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!