[SOLVED] How to Prevent ZFS pool import on boot up?

courtjesterau

New Member
Aug 31, 2023
14
5
3
Hi,

I have recently moved to proxmox VE from VMware for my home lab and am new to linux hypervisors and linux in general so please be nice. I have an unrad system virtualized and hosted on the proxmox host where I pass through one of the on board SATA controllers to this machine for its storage.

I ahve a zfs pool set up in unraid acting as my cache storage space. If I reboot the proxmox host it auto imports this zfs pool on boot and it is unabled to be imported into my unraid system ( until I manually do this ) preventing the array from starting automatically.

my question is this: How do I prevent proxmos auto importing this zfs pool automatically on boot up?
 
Hi,

I have recently moved to proxmox VE from VMware for my home lab and am new to linux hypervisors and linux in general so please be nice. I have an unrad system virtualized and hosted on the proxmox host where I pass through one of the on board SATA controllers to this machine for its storage.

I ahve a zfs pool set up in unraid acting as my cache storage space. If I reboot the proxmox host it auto imports this zfs pool on boot and it is unabled to be imported into my unraid system ( until I manually do this ) preventing the array from starting automatically.

my question is this: How do I prevent proxmos auto importing this zfs pool automatically on boot up?
Hi,
proxmox imports the zpools by cache file, so if you can set the cachefile for that pool to none by running zpool set cachefile=none <poolname>
 
  • Like
Reactions: fireon
Hi,
proxmox imports the zpools by cache file, so if you can set the cachefile for that pool to none by running zpool set cachefile=none <poolname>
Hi Yes I did ready that in my googling but I got confused

as when I go to the shell and enter: nano /etc/zfs/zpool.cache

to edit the cache file it is blank should I just add the line in the above location? Sorry I am very new to proxmox / Linux

if that is not the correct file can you please point me in the right direction
 
as when I go to the shell and enter: nano /etc/zfs/zpool.cache

to edit the cache file it is blank should I just add the line in the above location? Sorry I am very new to proxmox / Linux
You should not manually edit the cache file via a text editor. You will have to run the command in your shell.
 
thank you for the help but I must be doing something wrong

I open the shell enter: zpool set cachefile=none cache

I reboot and the zfs pool is still imported

is there another step / something I am missing here?
 
thank you for the help but I must be doing something wrong

I open the shell enter: zpool set cachefile=none cache

I reboot and the zfs pool is still imported

is there another step / something I am missing here?
Please share the output of zpool list and zpool get cachefile. Also indicate which is the pool you would not like to be imported at boot.
 
root@pve2:~# zpool list
NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
cache 7.27T 31.6G 7.23T - - 0% 0% 1.00x ONLINE -
root@pve2:~#



and

root@pve2:~# zpool get cachefile
NAME PROPERTY VALUE SOURCE
cache cachefile none local
root@pve2:~#
 
root@pve2:~# zpool list
NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
cache 7.27T 31.6G 7.23T - - 0% 0% 1.00x ONLINE -
root@pve2:~#



and

root@pve2:~# zpool get cachefile
NAME PROPERTY VALUE SOURCE
cache cachefile none local
root@pve2:~#


I only have one zpool (named cache) and I dont want it imported on boot but if I want to add one for the host later on I dont want to permantly disable zfs if I can avoid it
 
root@pve2:~# zpool list
NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
cache 7.27T 31.6G 7.23T - - 0% 0% 1.00x ONLINE -
root@pve2:~#



and

root@pve2:~# zpool get cachefile
NAME PROPERTY VALUE SOURCE
cache cachefile none local
root@pve2:~#
Please post also the output of systemctl status zfs-import.service zfs-import-cache.service zfs-import-scan.service.
 
Please post also the output of systemctl status zfs-import.service zfs-import-cache.service zfs-import-scan.service.
Hi here is the output:


root@pve2:~# systemctl status zfs-import.service zfs-import-cache.service zfs-import-scan.service
○ zfs-import.service
Loaded: masked (Reason: Unit zfs-import.service is masked.)
Active: inactive (dead)

○ zfs-import-cache.service - Import ZFS pools by cache file
Loaded: loaded (/lib/systemd/system/zfs-import-cache.service; enabled; preset: enabled)
Active: inactive (dead)
Condition: start condition failed at Fri 2023-09-01 23:11:51 AEST; 7h ago
└─ ConditionFileNotEmpty=/etc/zfs/zpool.cache was not met
Docs: man:zpool(8)

Sep 01 23:11:51 pve2 systemd[1]: zfs-import-cache.service - Import ZFS pools by cache file was skipped because of an unmet condition check (ConditionFileNotEmpty=/etc/>

× zfs-import-scan.service - Import ZFS pools by device scanning
Loaded: loaded (/lib/systemd/system/zfs-import-scan.service; enabled; preset: disabled)
Active: failed (Result: exit-code) since Fri 2023-09-01 23:11:52 AEST; 7h ago
Docs: man:zpool(8)
Process: 1233 ExecStart=/sbin/zpool import -aN -d /dev/disk/by-id -o cachefile=none $ZPOOL_IMPORT_OPTS (code=exited, status=1/FAILURE)
Main PID: 1233 (code=exited, status=1/FAILURE)
CPU: 86ms

Sep 01 23:11:51 pve2 systemd[1]: Starting zfs-import-scan.service - Import ZFS pools by device scanning...
Sep 01 23:11:51 pve2 zpool[1233]: cannot import 'disk2': pool was previously in use from another system.
Sep 01 23:11:51 pve2 zpool[1233]: Last accessed by pve2 (hostid=f5b0a663) at Thu Jan 1 10:00:00 1970
Sep 01 23:11:51 pve2 zpool[1233]: The pool can be imported, use 'zpool import -f' to import the pool.
Sep 01 23:11:52 pve2 zpool[1233]: cannot import 'disk1': one or more devices is currently unavailable
Sep 01 23:11:52 pve2 systemd[1]: zfs-import-scan.service: Main process exited, code=exited, status=1/FAILURE
Sep 01 23:11:52 pve2 systemd[1]: zfs-import-scan.service: Failed with result 'exit-code'.
Sep 01 23:11:52 pve2 systemd[1]: Failed to start zfs-import-scan.service - Import ZFS pools by device scanning.
lines 1-29/29 (END)
 
  • Like
Reactions: semanticbeeng
Hi here is the output:


root@pve2:~# systemctl status zfs-import.service zfs-import-cache.service zfs-import-scan.service
○ zfs-import.service
Loaded: masked (Reason: Unit zfs-import.service is masked.)
Active: inactive (dead)

○ zfs-import-cache.service - Import ZFS pools by cache file
Loaded: loaded (/lib/systemd/system/zfs-import-cache.service; enabled; preset: enabled)
Active: inactive (dead)
Condition: start condition failed at Fri 2023-09-01 23:11:51 AEST; 7h ago
└─ ConditionFileNotEmpty=/etc/zfs/zpool.cache was not met
Docs: man:zpool(8)

Sep 01 23:11:51 pve2 systemd[1]: zfs-import-cache.service - Import ZFS pools by cache file was skipped because of an unmet condition check (ConditionFileNotEmpty=/etc/>

× zfs-import-scan.service - Import ZFS pools by device scanning
Loaded: loaded (/lib/systemd/system/zfs-import-scan.service; enabled; preset: disabled)
Active: failed (Result: exit-code) since Fri 2023-09-01 23:11:52 AEST; 7h ago
Docs: man:zpool(8)
Process: 1233 ExecStart=/sbin/zpool import -aN -d /dev/disk/by-id -o cachefile=none $ZPOOL_IMPORT_OPTS (code=exited, status=1/FAILURE)
Main PID: 1233 (code=exited, status=1/FAILURE)
CPU: 86ms

Sep 01 23:11:51 pve2 systemd[1]: Starting zfs-import-scan.service - Import ZFS pools by device scanning...
Sep 01 23:11:51 pve2 zpool[1233]: cannot import 'disk2': pool was previously in use from another system.
Sep 01 23:11:51 pve2 zpool[1233]: Last accessed by pve2 (hostid=f5b0a663) at Thu Jan 1 10:00:00 1970
Sep 01 23:11:51 pve2 zpool[1233]: The pool can be imported, use 'zpool import -f' to import the pool.
Sep 01 23:11:52 pve2 zpool[1233]: cannot import 'disk1': one or more devices is currently unavailable
Sep 01 23:11:52 pve2 systemd[1]: zfs-import-scan.service: Main process exited, code=exited, status=1/FAILURE
Sep 01 23:11:52 pve2 systemd[1]: zfs-import-scan.service: Failed with result 'exit-code'.
Sep 01 23:11:52 pve2 systemd[1]: Failed to start zfs-import-scan.service - Import ZFS pools by device scanning.
lines 1-29/29 (END)
Ah okay, so you also have the zfs-import-scan.service enabled and active, which tries to import pools it finds scanning devices. Disable it via systemctl disable --now zfs-import-scan.service and try once again to reboot.
 
H
Ah okay, so you also have the zfs-import-scan.service enabled and active, which tries to import pools it finds scanning devices. Disable it via systemctl disable --now zfs-import-scan.service and try once again to reboot.

Yes that stopped it from importing on boot thank you

One extra question If I want to ad a zpol to the host for it to use how would I get it imported if this is disabled? Is it just a matter of adding a cache file for the pool?
 
H


Yes that stopped it from importing on boot thank you

One extra question If I want to ad a zpol to the host for it to use how would I get it imported if this is disabled? Is it just a matter of adding a cache file for the pool?
Glad that it acts as intended now. Yes, in order to import a zpool in Proxmox VE, using the default cache file mechanism is enough to import the pool. Please mark the thread as solved, if the issue is fixed for you, so others can find solutions more easily, thanks.
 
Had the same output as listed above in post #12.
Ok, I stopped the scan service and got my server to boot again. Now my question is what is the purpose of the scan service during boot?
 
Had the same output as listed above in post #12.
Ok, I stopped the scan service and got my server to boot again. Now my question is what is the purpose of the scan service during boot?
Same... glad I stumbled upon this thread while it's still an active discussion.

I just had the same issue... rebuilding my proxmox setup and when I do a fresh install with only one disk in my system I don't have any issues.
But when I add an additional hard drive that I've used w proxmox in the past (drive has been wiped since then) I get the "failed to start zfs-import-scan.service" error (maybe I also need to wipe the drive filesystem or something)?

root@pve:~# systemctl status zfs-import-scan.service
× zfs-import-scan.service - Import ZFS pools by device scanning
Loaded: loaded (/lib/systemd/system/zfs-import-scan.service; enabled; preset: disabled)
Active: failed (Result: exit-code) since Sun 2023-12-10 13:22:32 MST; 21min ago
Docs: man:zpool(8)
Process: 632 ExecStart=/sbin/zpool import -aN -d /dev/disk/by-id -o cachefile=none $ZPOOL_IMPORT_OPTS (code=exited, status=1/FAILURE)
Main PID: 632 (code=exited, status=1/FAILURE)
CPU: 17ms
Dec 10 13:22:32 pve systemd[1]: Starting zfs-import-scan.service - Import ZFS pools by device scanning...
Dec 10 13:22:32 pve zpool[632]: cannot import 'local-storage': pool was previously in use from another system.
Dec 10 13:22:32 pve zpool[632]: Last accessed by pve (hostid=e68ad066) at Wed Dec 31 17:00:00 1969
Dec 10 13:22:32 pve zpool[632]: The pool can be imported, use 'zpool import -f' to import the pool.
Dec 10 13:22:32 pve systemd[1]: zfs-import-scan.service: Main process exited, code=exited, status=1/FAILURE
Dec 10 13:22:32 pve systemd[1]: zfs-import-scan.service: Failed with result 'exit-code'.
Dec 10 13:22:32 pve systemd[1]: Failed to start zfs-import-scan.service - Import ZFS pools by device scanning.

I too would like to know what the purpose of the scan is during boot and if it's something I should re-enable later?
 

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!