August 25, 2010

Local zone recreation on zfs

Posted in Solaris at 12:38 pm by alessiodini

Hi!
i have been away for some vacation , seaside and study!
I’m writing a couple of tools ( 1 for sun cluster , 1 for Solaris ) and i’m doing some test 🙂

Anyway , i recently did a job on a local zone.
Due to request , i have destroyed and I have rebuilt a dataset and a zone.
Follow the steps:

# zoneadm list -cv | grep 11
27 zone11 running /zone11 native shared

# zpool list
NAME SIZE USED AVAIL CAP HEALTH ALTROOT
[…]
rootdg_zone11 14.9G 5.45G 9.43G 36% ONLINE –
[…]

our pool is 11 😀
Now le’ts see how zpool was done

# zpool history rootdg_zone11
History for ‘rootdg_zone11’:
2008-09-23.12:00:56 zpool create rootdg_zone11 c19t60060E8005138A000000639A0000011Ed0
2008-09-23.12:01:01 zfs create rootdg_zone11/fs_zone11
2008-09-23.12:01:02 zfs set mountpoint=/mnt_zone11 rootdg_zone11/fs_zone11
2009-02-25.18:18:14 zpool export rootdg_zone11
2009-02-25.18:18:48 zpool import rootdg_zone11
2009-04-09.14:46:31 zfs snapshot rootdg_zone11/fs_zone11@now

– halt local zone

# zoneadm -z zone11 halt

– backup xml’s zone

# cd /var/bck
# cp -prf /etc/zones/zone11.xml .

– unistall

# zoneadm -z zone11 uninstall
Are you sure you want to uninstall zone zone11 (y/[n])? y

– Umount of dataset’s filesystem

# zfs unmount /rootdg_zone11 ( first part of root )

– check of rootdg_zone11 pool status

# zpool status -v rootdg_zone11
pool: rootdg_zone11
state: ONLINE
status: The pool is formatted using an older on-disk format. The pool can
still be used, but some features are unavailable.
action: Upgrade the pool using ‘zpool upgrade’. Once this is done, the
pool will no longer be accessible on older software versions.
scrub: none requested
config:

NAME STATE READ WRITE CKSUM
rootdg_zone11 ONLINE 0 0 0
c19t60060E8005138A000000639A0000011Ed0 ONLINE 0 0 0

errors: No known data errors

– umount zone’s zonepath

# zfs unmount /mnt_zone11

– delete dataset

# zfs destroy -r rootdg_zone11/fs_zone11

– i create a dataset like in previous history
– i did import / export of zpool ( just for a test )
– installation time 🙂

# zoneadm -z zone11 install
Preparing to install zone .

– boot

# zoneadm -z zone11 boot

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: