Matt Keenan
2011-May-27 09:21 UTC
[zfs-discuss] Ensure Newly created pool is imported automatically in new BE
Hi, Trying to ensure a newly created data pool gets import on boot into a new BE. Scenario : Just completed a AI install, and on the client before I reboot I want to create a data pool, and have this pool automatically imported on boot into the newly installed AI Boot Env. Trying to use the -R altroot option to zpool create to achieve this or the zpool set -o cachefile property, but having no luck, and would like some advice on what the best means of achieving this would be. When the install completes, we have a default root pool "rpool", which contains a single default boot environment, rpool/ROOT/solaris This is mounted on /a so I tried : zpool create -R /a mypool c3d0 Also tried : zpool create mypool c3d0 zpool set -o cachefile=/a mypool I can clearly see /a/etc/zfs/zpool.cache contains information for rpool, but it does not get any information about mypool. I would expect this file to contain some reference to mypool. So I tried : zpool set -o cachefile=/a/etc/zfs/zpool.cache Which fails. Any advice would be great. cheers Matt
Jim Klimov
2011-May-27 12:43 UTC
[zfs-discuss] Ensure Newly created pool is imported automatically in new BE
Did you try it as a single command, somewhat like: zpool create -R /a -o cachefile=/a/etc/zfs/zpool.cache mypool c3d0 Using altroots and cachefile(=none) explicitly is a nearly-documented way to avoid caching pools which you would not want to see after reboot, i.e. removable media. I think that after the AI is done and before reboot you might want to reset the altroot property to point to root (or be undefined) so that the data pool is mounted into your new rpools hierarchy and not under "/a/mypool" again ;) And if your AI setup does not use the data pool, you might be better off not using altroot at all, maybe... ----- Original Message ----- From: Matt Keenan <mattman at opensolaris.org> Date: Friday, May 27, 2011 13:25 Subject: [zfs-discuss] Ensure Newly created pool is imported automatically in new BE To: zfs-discuss at opensolaris.org> Hi, > > Trying to ensure a newly created data pool gets import on boot > into a > new BE. > > Scenario : > Just completed a AI install, and on the client > before I reboot I want > to create a data pool, and have this pool automatically imported > on boot > into the newly installed AI Boot Env. > > Trying to use the -R altroot option to zpool create > to achieve this or > the zpool set -o cachefile property, but having no luck, and > would like > some advice on what the best means of achieving this would be. > > When the install completes, we have a default root pool "rpool", which > contains a single default boot environment, rpool/ROOT/solaris > > This is mounted on /a so I tried : > zpool create -R /a mypool c3d0 > > Also tried : > zpool create mypool c3d0 > zpool set -o cachefile=/a mypool > > I can clearly see /a/etc/zfs/zpool.cache contains information > for rpool, > but it does not get any information about mypool. I would expect > this > file to contain some reference to mypool. So I tried : > zpool set -o cachefile=/a/etc/zfs/zpool.cache > > Which fails. > > Any advice would be great. > > cheers > > Matt > _______________________________________________ > zfs-discuss mailing list > zfs-discuss at opensolaris.org > http://mail.opensolaris.org/mailman/listinfo/zfs-discuss-- +============================================================+ | | | ?????? ???????, Jim Klimov | | ??????????? ???????? CTO | | ??? "??? ? ??" JSC COS&HT | | | | +7-903-7705859 (cellular) mailto:jimklimov at cos.ru | | CC:admin at cos.ru,jimklimov at gmail.com | +============================================================+ | () ascii ribbon campaign - against html mail | | /\ - against microsoft attachments | +============================================================+ -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.opensolaris.org/pipermail/zfs-discuss/attachments/20110527/ae66afde/attachment.html>
Matt Keenan
2011-May-31 16:32 UTC
[zfs-discuss] Ensure Newly created pool is imported automatically in new BE
Jim, Thanks for the response, I''ve nearly got it working, coming up against a hostid issue. Here''s the steps I''m going through : - At end of auto-install, on the client just installed before I manually reboot I do the following : $ beadm mount solaris /a $ zpool export data $ zpool import -R /a -N -o cachefile=/a/etc/zfs/zpool.cache data $ beadm umount solaris $ reboot - Before rebooting I check /a/etc/zfs/zpool.cache and it does contain references to "data". - On reboot, the automatic import of data is attempted however following message is displayed : WARNING: pool ''data'' could not be loaded as it was last accessed by another system (host: ai-client hostid: 0x87a4a4). See http://www.sun.com/msg/ZFS-8000-EY. - Host id on booted client is : $ hostid 000c32eb As I don''t control the import command on boot i cannot simply add a "-f" to force the import, any ideas on what else I can do here ? cheers Matt On 05/27/11 13:43, Jim Klimov wrote:> Did you try it as a single command, somewhat like: > > zpool create -R /a -o cachefile=/a/etc/zfs/zpool.cache mypool c3d0 > Using altroots and cachefile(=none) explicitly is a nearly-documented > way to avoid caching pools which you would not want to see after > reboot, i.e. removable media. > I think that after the AI is done and before reboot you might want to > reset the altroot property to point to root (or be undefined) so that > the data pool is mounted into your new rpools hierarchy and not > under "/a/mypool" again ;) > And if your AI setup does not use the data pool, you might be better > off not using altroot at all, maybe... > > ----- Original Message ----- > From: Matt Keenan <mattman at opensolaris.org> > Date: Friday, May 27, 2011 13:25 > Subject: [zfs-discuss] Ensure Newly created pool is imported > automatically in new BE > To: zfs-discuss at opensolaris.org > > > Hi, > > > > Trying to ensure a newly created data pool gets import on boot > > into a > > new BE. > > > > Scenario : > > Just completed a AI install, and on the client > > before I reboot I want > > to create a data pool, and have this pool automatically imported > > on boot > > into the newly installed AI Boot Env. > > > > Trying to use the -R altroot option to zpool create > > to achieve this or > > the zpool set -o cachefile property, but having no luck, and > > would like > > some advice on what the best means of achieving this would be. > > > > When the install completes, we have a default root pool "rpool", which > > contains a single default boot environment, rpool/ROOT/solaris > > > > This is mounted on /a so I tried : > > zpool create -R /a mypool c3d0 > > > > Also tried : > > zpool create mypool c3d0 > > zpool set -o cachefile=/a mypool > > > > I can clearly see /a/etc/zfs/zpool.cache contains information > > for rpool, > > but it does not get any information about mypool. I would expect > > this > > file to contain some reference to mypool. So I tried : > > zpool set -o cachefile=/a/etc/zfs/zpool.cache > > > > Which fails. > > > > Any advice would be great. > > > > cheers > > > > Matt > > _______________________________________________ > > zfs-discuss mailing list > > zfs-discuss at opensolaris.org > > http://mail.opensolaris.org/mailman/listinfo/zfs-discuss > -- > > +============================================================+ > | | > | ?????? ???????, Jim Klimov | > | ??????????? ???????? CTO | > | ??? "??? ? ??" JSC COS&HT | > | | > | +7-903-7705859 (cellular) mailto:jimklimov at cos.ru | > | CC:admin at cos.ru,jimklimov at gmail.com | > +============================================================+ > | () ascii ribbon campaign - against html mail | > | /\ - against microsoft attachments | > +============================================================+
Jim Klimov
2011-May-31 17:50 UTC
[zfs-discuss] Ensure Newly created pool is imported automatically in new BE
I should have seen that coming, but didn''t ;) I think in ths case I would go with a different approach: don''t import the data pool in the AI instance and save it to zpool.cache Instead, make sure it is cleanly exported from AI instance, and in the installed system create a self-destructing init script or SMF service. For an init script in might go like this: #!/bin/sh # /etc/rc2.d/S00importdatapool [ "$1" = start ] && zpool import -f datapool && rm -f "$0" Or you can try setting the hostid in a persisnt manner (perhaps via eeprom emulation in /boot/solaris/bootenv.rc ?) ----- Original Message ----- From: Matt Keenan <mattman at opensolaris.org> Date: Tuesday, May 31, 2011 21:02 Subject: Re: [zfs-discuss] Ensure Newly created pool is imported automatically in new BE To: jim at cos.ru Cc: zfs-discuss at opensolaris.org> Jim, > > Thanks for the response, I''ve nearly got it working, coming up > against a > hostid issue. > > Here''s the steps I''m going through : > > - At end of auto-install, on the client just installed before I > manually > reboot I do the following : > $ beadm mount solaris /a > $ zpool export data > $ zpool import -R /a -N -o > cachefile=/a/etc/zfs/zpool.cache data > $ beadm umount solaris > $ reboot > > - Before rebooting I check /a/etc/zfs/zpool.cache and it does > contain > references to "data". > > - On reboot, the automatic import of data is attempted however > following > message is displayed : > > WARNING: pool ''data'' could not be loaded as it was last > accessed by > another system (host: ai-client hostid: 0x87a4a4). See > http://www.sun.com/msg/ZFS-8000-EY. > > - Host id on booted client is : > $ hostid > 000c32eb > > As I don''t control the import command on boot i cannot simply > add a "-f" > to force the import, any ideas on what else I can do here ? > > cheers > > Matt > > On 05/27/11 13:43, Jim Klimov wrote: > > Did you try it as a single command, somewhat like: > > > > zpool create -R /a -o cachefile=/a/etc/zfs/zpool.cache mypool c3d0 > > Using altroots and cachefile(=none) explicitly is a nearly- > documented> way to avoid caching pools which you would not want > to see after > > reboot, i.e. removable media. > > I think that after the AI is done and before reboot you might > want to > > reset the altroot property to point to root (or be undefined) > so that > > the data pool is mounted into your new rpools hierarchy and not > > under "/a/mypool" again ;) > > And if your AI setup does not use the data pool, you might be better > > off not using altroot at all, maybe... > > > > ----- Original Message ----- > > From: Matt Keenan <mattman at opensolaris.org> > > Date: Friday, May 27, 2011 13:25 > > Subject: [zfs-discuss] Ensure Newly created pool is imported > > automatically in new BE > > To: zfs-discuss at opensolaris.org > > > > > Hi, > > > > > > Trying to ensure a newly created data pool gets import on boot > > > into a > > > new BE. > > > > > > Scenario : > > > Just completed a AI install, and on the client > > > before I reboot I want > > > to create a data pool, and have this pool automatically imported > > > on boot > > > into the newly installed AI Boot Env. > > > > > > Trying to use the -R altroot option to > zpool create > > > to achieve this or > > > the zpool set -o cachefile property, but having no luck, and > > > would like > > > some advice on what the best means of achieving this would be. > > > > > > When the install completes, we have a default root pool > "rpool", which > > > contains a single default boot environment, rpool/ROOT/solaris > > > > > > This is mounted on /a so I tried : > > > zpool create -R /a mypool c3d0 > > > > > > Also tried : > > > zpool create mypool c3d0 > > > zpool set -o cachefile=/a mypool > > > > > > I can clearly see /a/etc/zfs/zpool.cache contains information > > > for rpool, > > > but it does not get any information about mypool. I would expect > > > this > > > file to contain some reference to mypool. So I tried : > > > zpool set -o > cachefile=/a/etc/zfs/zpool.cache> > > > > Which fails. > > > > > > Any advice would be great. > > > > > > cheers > > > > > > Matt > > > _______________________________________________ > > > zfs-discuss mailing list > > > zfs-discuss at opensolaris.org > > > http://mail.opensolaris.org/mailman/listinfo/zfs-discuss > > -- > > > > +============================================================+ > > > | | > > | ?????? > ???????, Jim Klimov | > > | ??????????? > ???????? CTO | > > | ??? "??? ? > ??" JSC COS&HT | > > > | | > > | +7-903-7705859 > (cellular) mailto:jimklimov at cos.ru | > > > | CC:admin at cos.ru,jimklimov at gmail.com | > > +============================================================+ > > | () ascii ribbon campaign - against html > mail | > > | > /\ - against microsoft attachments | > > +============================================================+ >-- +============================================================+ | | | ?????? ???????, Jim Klimov | | ??????????? ???????? CTO | | ??? "??? ? ??" JSC COS&HT | | | | +7-903-7705859 (cellular) mailto:jimklimov at cos.ru | | CC:admin at cos.ru,jimklimov at gmail.com | +============================================================+ | () ascii ribbon campaign - against html mail | | /\ - against microsoft attachments | +============================================================+ -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.opensolaris.org/pipermail/zfs-discuss/attachments/20110531/9b4e0e98/attachment.html>
Jim Klimov
2011-May-31 18:15 UTC
[zfs-discuss] Ensure Newly created pool is imported automatically in new BE
Actually if you need beadm to "know" about the data pool, it might be beneficial to mix both approaches - yours with bemount, and init-script to enforce the pool import on that first boot... HTH, //Jim Klimov -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.opensolaris.org/pipermail/zfs-discuss/attachments/20110531/bdb32130/attachment.html>
Matt Keenan
2011-May-31 21:08 UTC
[zfs-discuss] Ensure Newly created pool is imported automatically in new BE
I''ve written a possible solution using svc-system-config SMF where on first boot it will import -f a specified list of pools, and it does work, I was hoping to find a cleaner solution via zpool.cache... but if there''s no way to achieve it I guess I''ll have to stick with the other solution. I even tried simply copying /etc/zfs/zpool.cache to /a/etc/zfs/zpool.cache and not exporting/importing the data pool at all, however this gave the same hostid problem. thanks for your help. cheers Matt Jim Klimov wrote:> Actually if you need beadm to "know" about the data pool, > it might be beneficial to mix both approaches - yours with > bemount, and init-script to enforce the pool import on that > first boot... > > HTH, > //Jim Klimov >
Daniel Carosone
2011-Jun-01 00:35 UTC
[zfs-discuss] Ensure Newly created pool is imported automatically in new BE
On Tue, May 31, 2011 at 05:32:47PM +0100, Matt Keenan wrote:> Jim, > > Thanks for the response, I''ve nearly got it working, coming up against a > hostid issue. > > Here''s the steps I''m going through : > > - At end of auto-install, on the client just installed before I manually > reboot I do the following : > $ beadm mount solaris /a > $ zpool export data > $ zpool import -R /a -N -o cachefile=/a/etc/zfs/zpool.cache data > $ beadm umount solaris > $ reboot > > - Before rebooting I check /a/etc/zfs/zpool.cache and it does contain > references to "data". > > - On reboot, the automatic import of data is attempted however following > message is displayed : > > WARNING: pool ''data'' could not be loaded as it was last accessed by > another system (host: ai-client hostid: 0x87a4a4). See > http://www.sun.com/msg/ZFS-8000-EY. > > - Host id on booted client is : > $ hostid > 000c32eb > > As I don''t control the import command on boot i cannot simply add a "-f" > to force the import, any ideas on what else I can do here ?Can you simply export the pool again before rebooting, but after the cachefile in /a has been unmounted? -- Dan. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 194 bytes Desc: not available URL: <http://mail.opensolaris.org/pipermail/zfs-discuss/attachments/20110601/c6826a27/attachment.bin>
Matt Keenan
2011-Jun-01 13:04 UTC
[zfs-discuss] Ensure Newly created pool is imported automatically in new BE
Dan, Tried export data after beadm umount, but on reboot zpool data is simply not imported at all... So exporting data before reboot dosen;t appear to help.. thanks Matt On 06/01/11 01:35, Daniel Carosone wrote:> On Tue, May 31, 2011 at 05:32:47PM +0100, Matt Keenan wrote: >> Jim, >> >> Thanks for the response, I''ve nearly got it working, coming up against a >> hostid issue. >> >> Here''s the steps I''m going through : >> >> - At end of auto-install, on the client just installed before I manually >> reboot I do the following : >> $ beadm mount solaris /a >> $ zpool export data >> $ zpool import -R /a -N -o cachefile=/a/etc/zfs/zpool.cache data >> $ beadm umount solaris >> $ reboot >> >> - Before rebooting I check /a/etc/zfs/zpool.cache and it does contain >> references to "data". >> >> - On reboot, the automatic import of data is attempted however following >> message is displayed : >> >> WARNING: pool ''data'' could not be loaded as it was last accessed by >> another system (host: ai-client hostid: 0x87a4a4). See >> http://www.sun.com/msg/ZFS-8000-EY. >> >> - Host id on booted client is : >> $ hostid >> 000c32eb >> >> As I don''t control the import command on boot i cannot simply add a "-f" >> to force the import, any ideas on what else I can do here ? > Can you simply export the pool again before rebooting, but after the > cachefile in /a has been unmounted? > > -- > Dan.