Page 1 of 1

Can I save pool ? [SAVED]

Posted: 07 Jan 2015 11:34
by alexey123
I'm work on TheBrig and begin attach zfs option for it

I create zfs on files for do experiment safely

Code: Select all

#!/bin/sh
WORKDIR=`pwd`
for i in 1 2 3 4  
do 
	dd if=/dev/zero of=${WORKDIR}/file${i} bs=100M count=4  
done
zpool create tank ${WORKDIR}/file1 ${WORKDIR}/file2 ${WORKDIR}/file3 ${WORKDIR}/file4 
zpool import -d ${WORKDIR}
I add postinit script for keep experimental pool alive after reboot

Code: Select all

zpool import -d /mnt/disk/afiles tank
Then I managed pool over webgui - all worked , jail's user can manage specified datasets, and user can access to files

But unfortunately I execute command under main (broke root, NOT EXECUTE!!)

Code: Select all

zfs set mountpoint=/ tank/jail/jail1
I successfully restored my test machine, but without my tested pool - when I try to connect it, I lost my NAS.

May I have chance repair mount point for tested pool, or I need delete files and create new ?
( I ask it because I must prevent this faultly command input on TheBrig :!: )

Re: Can I save pool ?

Posted: 07 Jan 2015 12:12
by b0ssman
the pool should still be there.

can't you just set the mountpoint to the original value?

Re: Can I save pool ?

Posted: 07 Jan 2015 12:21
by daoyama
Of course yes, you can import from other booted OS.
Using same version of LiveCD or LiveUSB is recommended but should work latest.

If you can't accsess rootfs, try shutdown by CTRL+ALT+DEL from console.
Or press power button if ACPI is enabled.

1. Booting without ZFS configured OS
2. verify your pool name
# zpool import
3. force import without mounting
# zpool import -f -N poolname
4. check your mountpoint
# zfs get mountpoint
5. correct mountpoint
# zfs set mountpoint=XXXX pool@dataset
6. shutdown and reboot normal way

Re: Can I save pool ?

Posted: 07 Jan 2015 12:47
by alexey123
b0ssman wrote:the pool should still be there.
can't you just set the mountpoint to the original value?
I cannot restore mount point because dataset mounted instead root and I not have any command.

Many thanks for Aoyama san.
Command mast type with bold : zpool import -f -N poolname - great!!!!
If you can't accsess rootfs, try shutdown by CTRL+ALT+DEL from console.
Or press power button if ACPI is enabled.
I can pull the power cord also, but need run fsck in single user mode. ACPI always enabled for me , I pressed on power button

Then I connect usb flash to main server and run dmesg for identify his name. It was da1
Then under main server I execute

Code: Select all

mkdir /mnt/flash && mount /dev/da1a /mnt/flash
Then I open and edit with gui editor config.xml file - just remove entry

Code: Select all

zpool import -d /mnt/disk/afiles tank
Umount flash, plug it to tested server and boot it.
then execute great command - zpool import -f -N tank
Correct path and re - insert postinit comand

Code: Select all

zpool import -d /mnt/disk/afiles tank

My TheBrig scripts will work so, that they return the datasets into the same mount point, where jails took them, and additional, scripts will check forbidden paths