Re: Boot problem if a ZFS log device is missing

2013-09-02 Thread Maurizio Vairani

On 30/08/2013 12.46, Andriy Gapon wrote:

on 30/08/2013 13:37 Andriy Gapon said the following:

on 30/08/2013 00:38 Charles Sprickman said the following:

If one is willing to accept that data is lost (like the log device is totally 
smoked), is there a way to boot knowing that you may have some data loss, or is 
the only option to boot alternate media and force a pool import (assuming that 
works without the log device)?

I think it's the latter.  I am not aware of any way to select a behavior similar
to import -m or import -F during boot.
Perhaps... ZFS_IMPORT_MISSING_LOG should be a default behavior for a root pool
or maybe the behavior could be controllable by a tunable.


Maurizio,

you might want to try the following patch as an interim solution for your
environment:

--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
@@ -4112,6 +4112,7 @@ spa_import_rootpool(const char *name)
}
spa->spa_is_root = B_TRUE;
spa->spa_import_flags = ZFS_IMPORT_VERBATIM;
+   spa->spa_import_flags |= ZFS_IMPORT_MISSING_LOG; /* XXX make tunable */

/*
 * Build up a vdev tree based on the boot device's label config.



HI all,
unfortunately the patch don't works. The laptop returns the same error 
message: "Mounting from zfs:tank0 failed with error 6" and the same 
"mountroot>" prompt.


I am available for further testing if needs.

Thanks anyway,
Maurizio


___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Boot problem if a ZFS log device is missing

2013-08-30 Thread Maurizio Vairani

On 30/08/2013 13.45, Ronald Klop wrote:
On Fri, 30 Aug 2013 12:58:29 +0200, Johan Hendriks 
 wrote:



Maurizio Vairani wrote:

On 29/08/2013 11.01, Andriy Gapon wrote:

on 29/08/2013 11:27 Maurizio Vairani said the following:
I am able to boot the PC without a cache device but not without a 
log device. Why ?
The log could potentially contain uncommitted entries.  Without the 
log device
there is no knowing if it did or did not.  And if it did then the 
pool is
inconsistent state without the log device and so it can not be 
imported.


The cache is not persistent and so there is nothing needed from it 
upon a boot.



Thank you for the clear and concise reply.

Yesterday I have done some test. If I remove the stick from the USB 
port, before the shutdown the PC, it  don't crash but continues to 
works. Then  I am able to reboot the laptop without inserting the 
stick with a pool that works in degraded mode.


From the end user point of view a PC should always boot, even with a 
missing ZFS log device.


Regards
Maurizio

___
freebsd...@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-fs
To unsubscribe, send any mail to "freebsd-fs-unsubscr...@freebsd.org"

I do not agree with the following.
 From the end user point of view a PC should always boot, even 
with a missing ZFS log device.


I think it should give you a option to import the pool or not import 
the pool!

No problem  I agree,  a step in the right direction.
There could be a situation when you are not sure that the ZIL is 
commited, in that situation it would be handy if you can suspend the 
boot and make sure the ZIL is there when you reboot or import after 
you attached the ZIL.
I would hate it when it corrups my data just because we always 
import. with or without the ZIL.


In your test you remove the ZIL, and when you reboot then it imports 
correctly, as far as my knowledge goes this is ok, because when the 
pool is exported there is no left data in the ZIL, it was not there 
when we exported, so we can import even without the missing ZIL 
without problem.


I think he was just lucky his system wasn't writing a lot to the ZIL 
at the moment of removal. So his system was in a consistent state. 
Otherwise you just miss data which is in the ZIL and not on disk.

I have removed the stick when there isn't R/W to the disk.
BTW: Not everything goes through the ZIL. It is not the same as a 
journal. Only sync writes go to the ZIL. If you don't use databases or 
NFS or other software which wants to make sure data is on stable 
storage, you might rarely use the ZIL.

Thanks for the explanation.


Ronald.



regards
Johan





___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to 
"freebsd-stable-unsubscr...@freebsd.org"

Regards
Maurizio
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Boot problem if a ZFS log device is missing

2013-08-30 Thread Ronald Klop
On Fri, 30 Aug 2013 12:58:29 +0200, Johan Hendriks  
 wrote:



Maurizio Vairani wrote:

On 29/08/2013 11.01, Andriy Gapon wrote:

on 29/08/2013 11:27 Maurizio Vairani said the following:
I am able to boot the PC without a cache device but not without a log  
device. Why ?
The log could potentially contain uncommitted entries.  Without the  
log device
there is no knowing if it did or did not.  And if it did then the pool  
is
inconsistent state without the log device and so it can not be  
imported.


The cache is not persistent and so there is nothing needed from it  
upon a boot.



Thank you for the clear and concise reply.

Yesterday I have done some test. If I remove the stick from the USB  
port, before the shutdown the PC, it  don't crash but continues to  
works. Then  I am able to reboot the laptop without inserting the stick  
with a pool that works in degraded mode.


From the end user point of view a PC should always boot, even with a  
missing ZFS log device.


Regards
Maurizio

___
freebsd...@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-fs
To unsubscribe, send any mail to "freebsd-fs-unsubscr...@freebsd.org"

I do not agree with the following.
 From the end user point of view a PC should always boot, even with  
a missing ZFS log device.


I think it should give you a option to import the pool or not import the  
pool!
There could be a situation when you are not sure that the ZIL is  
commited, in that situation it would be handy if you can suspend the  
boot and make sure the ZIL is there when you reboot or import after you  
attached the ZIL.
I would hate it when it corrups my data just because we always import.  
with or without the ZIL.


In your test you remove the ZIL, and when you reboot then it imports  
correctly, as far as my knowledge goes this is ok, because when the pool  
is exported there is no left data in the ZIL, it was not there when we  
exported, so we can import even without the missing ZIL without problem.


I think he was just lucky his system wasn't writing a lot to the ZIL at  
the moment of removal. So his system was in a consistent state. Otherwise  
you just miss data which is in the ZIL and not on disk.
BTW: Not everything goes through the ZIL. It is not the same as a journal.  
Only sync writes go to the ZIL. If you don't use databases or NFS or other  
software which wants to make sure data is on stable storage, you might  
rarely use the ZIL.


Ronald.



regards
Johan





___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"

___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Boot problem if a ZFS log device is missing

2013-08-30 Thread Johan Hendriks

Maurizio Vairani wrote:

On 29/08/2013 11.01, Andriy Gapon wrote:

on 29/08/2013 11:27 Maurizio Vairani said the following:
I am able to boot the PC without a cache device but not without a 
log device. Why ?
The log could potentially contain uncommitted entries.  Without the 
log device
there is no knowing if it did or did not.  And if it did then the 
pool is

inconsistent state without the log device and so it can not be imported.

The cache is not persistent and so there is nothing needed from it 
upon a boot.



Thank you for the clear and concise reply.

Yesterday I have done some test. If I remove the stick from the USB 
port, before the shutdown the PC, it  don't crash but continues to 
works. Then  I am able to reboot the laptop without inserting the 
stick with a pool that works in degraded mode.


From the end user point of view a PC should always boot, even with a 
missing ZFS log device.


Regards
Maurizio

___
freebsd...@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-fs
To unsubscribe, send any mail to "freebsd-fs-unsubscr...@freebsd.org"

I do not agree with the following.
From the end user point of view a PC should always boot, even with 
a missing ZFS log device.


I think it should give you a option to import the pool or not import the 
pool!
There could be a situation when you are not sure that the ZIL is 
commited, in that situation it would be handy if you can suspend the 
boot and make sure the ZIL is there when you reboot or import after you 
attached the ZIL.
I would hate it when it corrups my data just because we always import. 
with or without the ZIL.


In your test you remove the ZIL, and when you reboot then it imports 
correctly, as far as my knowledge goes this is ok, because when the pool 
is exported there is no left data in the ZIL, it was not there when we 
exported, so we can import even without the missing ZIL without problem.


regards
Johan





___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Boot problem if a ZFS log device is missing

2013-08-30 Thread Andriy Gapon
on 30/08/2013 13:37 Andriy Gapon said the following:
> on 30/08/2013 00:38 Charles Sprickman said the following:
>> If one is willing to accept that data is lost (like the log device is 
>> totally smoked), is there a way to boot knowing that you may have some data 
>> loss, or is the only option to boot alternate media and force a pool import 
>> (assuming that works without the log device)?
> 
> I think it's the latter.  I am not aware of any way to select a behavior 
> similar
> to import -m or import -F during boot.
> Perhaps... ZFS_IMPORT_MISSING_LOG should be a default behavior for a root pool
> or maybe the behavior could be controllable by a tunable.
> 

Maurizio,

you might want to try the following patch as an interim solution for your
environment:

--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
@@ -4112,6 +4112,7 @@ spa_import_rootpool(const char *name)
}
spa->spa_is_root = B_TRUE;
spa->spa_import_flags = ZFS_IMPORT_VERBATIM;
+   spa->spa_import_flags |= ZFS_IMPORT_MISSING_LOG; /* XXX make tunable */

/*
 * Build up a vdev tree based on the boot device's label config.


-- 
Andriy Gapon
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Boot problem if a ZFS log device is missing

2013-08-30 Thread Andriy Gapon
on 30/08/2013 00:38 Charles Sprickman said the following:
> If one is willing to accept that data is lost (like the log device is totally 
> smoked), is there a way to boot knowing that you may have some data loss, or 
> is the only option to boot alternate media and force a pool import (assuming 
> that works without the log device)?

I think it's the latter.  I am not aware of any way to select a behavior similar
to import -m or import -F during boot.
Perhaps... ZFS_IMPORT_MISSING_LOG should be a default behavior for a root pool
or maybe the behavior could be controllable by a tunable.

-- 
Andriy Gapon
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Boot problem if a ZFS log device is missing

2013-08-30 Thread Maurizio Vairani

On 29/08/2013 11.01, Andriy Gapon wrote:

on 29/08/2013 11:27 Maurizio Vairani said the following:

I am able to boot the PC without a cache device but not without a log device. 
Why ?

The log could potentially contain uncommitted entries.  Without the log device
there is no knowing if it did or did not.  And if it did then the pool is
inconsistent state without the log device and so it can not be imported.

The cache is not persistent and so there is nothing needed from it upon a boot.


Thank you for the clear and concise reply.

Yesterday I have done some test. If I remove the stick from the USB 
port, before the shutdown the PC, it  don't crash but continues to 
works. Then  I am able to reboot the laptop without inserting the stick 
with a pool that works in degraded mode.


From the end user point of view a PC should always boot, even with a 
missing ZFS log device.


Regards
Maurizio

___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Boot problem if a ZFS log device is missing

2013-08-29 Thread Charles Sprickman
On Aug 29, 2013, at 5:01 AM, Andriy Gapon wrote:

> on 29/08/2013 11:27 Maurizio Vairani said the following:
>> 
>> I am able to boot the PC without a cache device but not without a log 
>> device. Why ?
> 
> The log could potentially contain uncommitted entries.  Without the log device
> there is no knowing if it did or did not.  And if it did then the pool is
> inconsistent state without the log device and so it can not be imported.

If one is willing to accept that data is lost (like the log device is totally 
smoked), is there a way to boot knowing that you may have some data loss, or is 
the only option to boot alternate media and force a pool import (assuming that 
works without the log device)?

Charles

> 
> The cache is not persistent and so there is nothing needed from it upon a 
> boot.
> 
> -- 
> Andriy Gapon
> ___
> freebsd...@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-fs
> To unsubscribe, send any mail to "freebsd-fs-unsubscr...@freebsd.org"

___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Boot problem if a ZFS log device is missing

2013-08-29 Thread Andriy Gapon
on 29/08/2013 11:27 Maurizio Vairani said the following:
> 
> I am able to boot the PC without a cache device but not without a log device. 
> Why ?

The log could potentially contain uncommitted entries.  Without the log device
there is no knowing if it did or did not.  And if it did then the pool is
inconsistent state without the log device and so it can not be imported.

The cache is not persistent and so there is nothing needed from it upon a boot.

-- 
Andriy Gapon
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Boot problem if a ZFS log device is missing

2013-08-29 Thread Maurizio Vairani

Hi all,
I am using an USB memory stick as cache and log devices for a HDD ZFS 
pool named tank0:

$ zpool status -v tank0
  pool: tank0
 state: ONLINE
  scan: scrub repaired 0 in 7h19m with 0 errors on Tue Jul 30 06:11:23 2013
config:

NAME STATE READ WRITE CKSUM
tank0ONLINE   0 0 0
  ada0s1dONLINE   0 0 0
logs
  gpt/SLOG   ONLINE   0 0 0
cache
  gpt/L2ARC  ONLINE   0 0 0

errors: No known data errors

If I remove the stick before booting the laptop (a Compaq Presario) it 
will not boot with the error message:

"Mounting from zfs:tank0 failed with error 6"
end the mountroot> prompt is displayed.
I need to reinsert the stick to completing the boot process before 
restarting the laptop.


It is possible to boots the laptop without stick if I remove the log 
device with the command:

# zpool remove tank0 gpt/SLOG
before switching it off. The pool will works in degraded mode because 
the cache device is missing, but it works.


I am able to boot the PC without a cache device but not without a log 
device. Why ?

The laptop is updated to 9.2-PRERELEASE r254783.

Regards
Maurizio

___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"