Broken OpenSolaris? NEVER!

If for some reason your OpenSolaris installation is broken or you want to have an exact system on many computers here is the recipe, which I have successfully tested yesterday!

What you will need?
- SSH access to working OpenSolaris - thanks Bob. ;)
- Some free time (copying took around 1h for me, while I was still able to use my OpenSolaris box!!!)

Let's start
1. On your computer choose some unique zfs filesystem name. To check for the names currently used on your system, type the following command in the terminal:
   $ /usr/sbin/zfs list -rHo name rpool/ROOT
   I will use rpool/ROOT/opensolarisbob as it was not listed

2. Make sure you know the IP address of your box:
   $ /usr/sbin/ifconfig -a
   In our case it's 192.168.0.120

3. Log to Bob computer (192.168.0.100):
   $ ssh -l username 192.168.0.100

4. List all BE's and choose the one which you want to copy:
   bob$ /usr/sbin/beadm list -a
   In our case we will use the one:
   opensolaris
     rpool/ROOT/opensolaris

5. From the rpool/ROOT/opensolaris filesystem create snapshot which we will name mysnapshot:
   bob$ pfexec /usr/sbin/zfs snapshot \\
   rpool/ROOT/opensolaris@mysnapshot

6. Send the filesystem to our computer using ssh and login name migi:
   bob$ pfexec /usr/sbin/zfs send \\
   rpool/ROOT/opensolaris@mysnapshot | ssh \\
   migi@192.168.0.120 \\
   "pfexec /usr/sbin/zfs recv rpool/ROOT/opensolarisbob"

7. At this point you should see new be on your computer:
   $ /usr/sbin/beadm list

8. Activate the new BE:
   $ pfexec /usr/sbin/beadm activate opensolarisbob

That's All. At this point the system is the same as on the Bob's computer including users and passwords.
If you want to restore your users and passwords you can mount the new BE and copy over or edit few files.
I did something else by simply "restoring" my user "migi" to the new BE by:
pfexec /usr/sbin/beadm mount opensolarisbob /tmp/opensolarisbob
pfexec grep migi /etc/passwd >> /tmp/opensolarisbob/etc/passwd
pfexec grep migi /etc/group >> /tmp/opensolarisbob/etc/group
pfexec grep migi /etc/shadow >> /tmp/opensolarisbob/etc/shadow
pfexec grep migi /etc/user_attr >> /tmp/opensolarisbob/etc/user_attr

Of course if you can't login to your broken OpenSolaris you could use liveCD, import pool and do the same trick, please let me know if you need such instructions.

By the way it's pretty amazing that copying 3GB of the data took around 1h:


View Larger Map

Comments:

This is really interesting and useful! Thanks for sharing!

Posted by Peter on April 09, 2009 at 11:00 AM UTC #

I recently came across your blog and have been reading along. I thought I would leave my first comment. I don't know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often.

Ruth

http://laptopmessengerbag.info

Posted by Ruth on April 10, 2009 at 08:10 PM UTC #

Great article!

Posted by Patrick on May 07, 2009 at 08:06 PM UTC #

Hi Michal,

Great article. I just tried it, and it's as simple as you make it look.

I would like to use these instructions to set up a box from scratch, using the live CD.

Can you format the disk with multiple partitions?
The graphical installer doesn't seem to allow that. You have to use the whole disk.

I've bought an SSD, and I'd like to put rpool on it, plus the write cache and ZIL for my datapool.

John

Posted by John on August 30, 2009 at 12:03 AM UTC #

Please clarify, is it possible to copy over an BE even if the hardware differs between computers?? That doesnt seem right? For this to work, you need the exactly same setup, yes? Could you please add a note on this?

For instance, you could not copy over an BE to SPARC opensolaris. So when is this applicable?

Posted by Mike on October 03, 2009 at 08:40 PM UTC #

Post a Comment:
Comments are closed for this entry.
About

migi

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today