• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

How do I mount a ZFS root pool from Fixit without importing it?

retheoff

New Member

Thanks: 1
Messages: 6

#1
Hi all!
I installed my root system on ZFS pool. Which works great, however, I was testing a repair scenario where I wanted to boot into Fixit on the install CD and then access that root ZFS pool to modify files. (for example, to fix a boot problem) I was not able to get access to that ZFS pool. If I import it, it breaks fixit environment and I can't run any commands. I don't think you can mount a ZFS filesystem without importing it, or change a mountpoin witout importing the pool. I do understand that you should not export the root ZFS pool, and force importing probably breaks the pool. So, how does one get access from Fixit (or another system) to a non-booting ZFS pool with root FreeBSD installation on it?

Just a little background on my system:
I have the drive setup with gptzfsboot. 1 partition is freebsd-boot, 1 is freebsd-swap, and a 3rd is freebsd-zfs for the root pool. I call it "rpool", and the freebsd installation is in "rpool/ROOT".

Thanks for the help!
Greg
 

henker

New Member


Messages: 13

#2
I have the same problem
Actually I'm having a boot problem
I dualboot win7 and freebsd (zfs on root) on the same hdd and when I installed the freebsd bootloader windows 7 simply wouldn't load anymore, then I reinstalled win7 bootloader, which gives me option to boot freebsd but I get error

Hopefully someone knows how to help us
 

phoenix

Administrator
Staff member
Administrator
Moderator

Thanks: 1,124
Messages: 3,944

#3
When in doubt, read the zpool() man page. :) Be sure to pay attention to the different variations of the zpool import command, especially the parts about -o and -R. :) It's all in there.
 

retheoff

New Member

Thanks: 1
Messages: 6

#4
phoenix said:
When in doubt, read the zpool() man page. :) Be sure to pay attention to the different variations of the zpool import command, especially the parts about -o and -R. :) It's all in there.
Oh man... I am a maroon. Thanks Phoenix!! I skimmed through the man page and completely missed that. (even though its in plain sight!) I should have RTEFM. :r
Thanks again!
 

volatilevoid

Active Member

Thanks: 20
Messages: 172

#5
As I needed to mount my zpool from Fixit, I figured out that zpool import and zfs mount don't mount legacy mountpoints.

They can be mounted with
# mount -t zfs <pool name> <directory>

Maybe this is helpful to someone.
 

Woland

New Member

Thanks: 10
Messages: 19

#6
I am a new to ZFS, and am finding this simple task incredibly frustrating. Since this page came up over and over in my searches, I am going to try to answer the question subject WITHOUT referring to the man page, in the hopes that others can have an easier time with this than I.

I messed up the fstab file, and now to get my system to boot all I have to do is mount my root partition and insert a "#" But, since I chose an all ZFS-install, not quite so easy as it seems.

1.) First, through a ton of Googling, I found out that you have to place a couple of symlinks and load the kernel module before zfs tools will even work of the rescue image USB:

[cmd=]Fixit# ln -s /dist/boot/kernel /boot/kernel[/cmd]
[cmd=]Fixit# ls -s /dist/lib /lib[/cmd]
[cmd=]Fixit# kldload zfs[/cmd]

2.) Since I booted from USB (the FreeBSD-8.1-RELEASE-amd64-memstick.img for the curious) zfs doesn't yet know about what disks to use. The way it finds out is through zpool import. Use [cmd=]zpool import[/cmd]" by itself to list the pools that are available on your system. You can then run [cmd=]zpool import poolname[/cmd]
http://docs.huihoo.com/opensolaris/solaris-zfs-administration-guide/html/ch04s06.html#gazru
zpool gave me an error about the pool being in use, so I had to rerun the command:

[cmd=]Fixit# zpool import -f poolname[/cmd]

The pool can now be mounted in the (empty) /mnt direcory as per volatilevoid above:

[cmd=]Fixit# mount -t zfs poolname /mnt[/cmd]

And Bob's your uncle.
 

matias

New Member

Thanks: 3
Messages: 2

#7
If you are, for instance, importing a root pool with a file system which mount point is defined as / or /usr (just an example), a plain import like:

[cmd="Fixit#"] zpool import -f poolname[/cmd]

will conflict with the fixit console files and

[cmd="Fixit#"] mount -t zfs poolname /mnt[/cmd]

will come too late. You will be better off specifying at import time the alternate root mountpoint, just in case:

[cmd="Fixit#"] zpool import -R /mnt -f poolname[/cmd]

or

[cmd="Fixit#"] zpool import -o mountpoint=/mnt -f poolname[/cmd]


You can also save time by loading the kernel modules requested for zfs directly, instead of creating symbolic links. If you are in the Fixit console, system files should be found in /mnt2. Youy would just need to type the following:

[cmd="Fixit#"] kldload /mnt2/boot/kernel/geom_mirror.ko[/cmd]
[cmd="Fixit#"] kldload /mnt2/boot/kernel/opensolaris.ko[/cmd]
[cmd="Fixit#"] kldload /mnt2/boot/kernel/zfs.ko[/cmd]
 

arrowcloud

New Member


Messages: 4

#8
Great post. I am the same situation and I used
Code:
Fixit# zpool import -o mountpoint=/tmp -f poolname
I can now see the mount points that I created for /usr, /tmp, /var in the /tmp folder. However I still don't know how to access /etc or /boot - which are the important folder that I need to rescue files in. Would anyone know how to get there ?

Many thanks.
 
Top