Clone Solaris system using cpio backup

Here we go again.
I just got the time to work on this task.

So, I executed the command:

# find . -fstype ufs -depth -print | cpio -ov -O /mnt/CPIO/backup.cpio

The output files list was similar to what I got with "flar info". The directories were being copied.
The result is shown in the photo below...I still have no idea how to get the details of any error that is issued with these commands.
8471888 blocks
1 error(s).

Is this okay?

How can I use this CPIO backup to clone this file system into another machine?

Firstly, I've moved your topic to the Solaris forum proper because this isn't a beginners question at all.

I'm looking at your previous topics about the cloning. I'll be back shortly.

1 Like

To clone the system will take a number of steps that are usually performed by 'flar' like creating an empty structure to restore to, etc. The error that occurred in creating the archive is (probably) insignificant.

  1. Put one of the two IDE hard disks you have into the system. I think that you can use either of them because you can adjust the VTOC to suit.
  2. Just for good measure, install Solaris and boot it up. Installing Solaris will install the boot blocks at the front of the disk; sectors 0 and 1 that the boot prom transfers control to when the system boots. If, later, you suspect that these boot blocks have become corrupt (no reason that they should), you can rewrite them from single user with the 'installboot' command. Search for that if you need to.
  3. Shut the system down and boot into single user from DVD/CD.
# init 0

ok> boot cdrom -s

At the # prompt run 'format' and configure your VTOC. Now, looking at your good system VTOC screenshot I can see slices 4 & 5 are unassigned but have space allocated, however, slice 7 is unassigned and have zeros for cylinders and size as I would expect. Unless you are aware that some database or app need slices 4 & 5 as working space I would risk omitting them from the VTOC leaving them 'unassigned', start cylinder 0, overall space 0.
Therefore you can allocate space to slice 0 (root), slice 1 (swap), slice 3 (var), slice 6 (usr). If you are using your smaller hard drive I woudl reduce the number of cylinders allocated to /usr just a little bit because it is apparent that this filesystem is nothing like full and is the largest allocated filesystem.
REMEMBER to (i) write the edited VTOC back to the disk, and (ii) NEVER edit slice 2 that represents the whole disk. Your previous install of Solaris should have correctly configured slice 2 as the whole disk size so don't mess with it.

Reboot the system at this point into single user from DVD/CD and recheck using 'format' that the VTOC is as you need it.

Create new UFS filesystems on root, var and usr. (Raw devices specified)

# newfs /dev/rdsk/c0t0d0s0
# newfs /dev/rdsk/c0t0d0s3
# newfs /dev/rdsk/c0t0d0s6
  1. Now we need to build an empty mounted structure to take the restore.
    The DVD/CD will have a mountpoint /a. Mount slice 0 onto it.
# mount /dev/dsk/c0t0d0s0 /a

Change directory to /a

# cd /a

Create mountpoints for /var and /usr

# mkdir /var
# mkdir /usr

mount slices 3 and 6 on these mountpoints

# mount /dev/dsk/c0t0d0s3 /a/var
# mount /dev/dsk/c0t0d0s6 /a/usr
  1. We should now have an empty filesystems clone ready to take the restore stream. The cpio archive was (hopefully) made with 'find .' (NOT find /) so we need to position ourselves to the point where we want the restore to go
# cd /a

Check all looks correct with

# pwd
# ls

we should be at /a and the file listing should show /var and /usr (in addition to lost+found of course)

  1. Check that the network interface is up and running, ip address assigned, etc. If not, plumb and configure. You know how to do that.

  2. POINT 7 DELETED BY AUTHOR

  3. Mount your remote NFS handle on /mnt , you know how to do that. Although in this case the /mnt mountpoint is on the DVD/CD.

# mount <path to NFS handle> /mnt
  1. Check the path to your cpio archive, /mnt/CPIO/backup.cpio or whatever. Can you see the archive.

  2. Restore the whole system. Double double-check again that you are at /a before you run this next command.

# cpio -ivudlm -I /mnt/CPIO/backup.cpio (or whatever path)

Options above are
i - input
v - verbose
u - unconditional copy allow overwrites (shouldn't be needed here however)
d - permit the process to create any directories that it needs
l - link files if possible rather than create separates (cloning original)
m - retain last modified date/time info

I - path to cpio archive to read

That should start to stream the system in listing all the files as it goes. Let it run, don't touch it. Does it complete ok?

  1. Shut the system down and try a normal boot
# init 0
ok> boot

Does the system boot?

BE VERY AWARE that the clone will have the same ip address as the original so if your network switch is intelligent it might get confused and crash unless you shutdown the original and connect the clone on the same port of the switch.

Feel free to post back for anything that you need elaborated on.
Post back any show-stopping errors.
Post back anything that you don't quite understand.
Good luck.

3 Likes

I Don't know what to say!

Mad respect to the amount of valuable information in a single post.

To be honest, It feels very different when I'm able to comprehend your highly technical posts from the first attempt. I'm enjoying reading them.

So, I have to install Solaris completely from the 5 CD's I burned earlier.

Too bad I have only CD 1 with me now.
Didn't expect I would need the rest.

Well, no, you don't have to. I was only suggesting that to get the boot blocks onto the hard disk but you can do that with 'installboot' command from the booted DVD/CD.

Check that out and don't install Solaris.

EDIT: Since you've already installed Solaris on these hard drives previously and not over-written them the boot blocks are probably still there.

1 Like

Well, that's what we're here for. We try to be as clear as possible. Anything that you don't understand is probably our/my fault for not being clear enough so just shout. I've done this kind of thing so many times I might get complacent and forget something.

2 Likes

I have installed on the slightly smaller disk. But I wasn't sure if the OS was still there with all the installation attempts with the archive on NFS.

Yes, boot blocks should still be there, if not and boot process at the end errors, we'll use 'installboot' to write them to disk

1 Like

I followed your instructions step by step.
I didn't get any stopping errors.



But it failed to boot.
I will write my concerns shotly.

It doesn't look like it's even attempting to boot from hard disk.

  1. Try commanding it to boot from hard disk
ok> boot disk

or

ok> boot disk 0
  1. If that doesn't work perhaps we need to write out the boot blocks to the hard disk. We'll try and write out the boot blocks from the Solaris distribution of the root filesystem that you have hopefully restored. Let's see if we can.
ok> boot cdrom -s

NOTE: We need to specify the raw device 'rdsk' here. And, yes, those are backticks in the command line

# mount /dev/dsk/c0t0d0s0 /a
# installboot /a/usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c0t0d0s0

Does that error? If not, take the system down

# init 0

and try (1) above again.

Obviously, as always said, post back any error(s) but also in this case if it boots from the hard disk post back too. If it boots don't mess with anything without posting back first.

1 Like

I tried myself to force it boot from disk by typing boot disk.
I read that if it didn't find boot media it will attempt to search for bootable media over a network.

I will try again with boot disk 0
and I will follow the steps to write the boot blocks and post back.

That's correct but I'd half expect it to say something like it couldn't find a bootable disk. Perhaps the OBP is configured to go to net first.

1 Like

boot: cannot open 0
Enter filename [0]
I searched but didn't find helpful information.

disk0
One word.
Try also disk1

2 Likes

I tried both (one word). can't open boot device

File not found

Yes, of course that file is not there. I'm stupid. /usr is a separate filesystem!

Try this

# mount /dev/dsk/c0t0d0s0 /a
# mount /dev/dsk/c0t0d0s6 /a/usr
# installboot /a/usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c0t0d0s0

It tried to boot and then suddenly it shows this screen and reboots very quicky.
I tried to capture it.

Try forcing the booting Solaris to reconfigure itself by adding a '-r' switch

ok> boot disk -r
1 Like