Solaris 10: How to image a machine?

8,726

Solution 1

You already have the solution. Use dd inside solaris to do this on each filesystem

dd if=/dev/zero of=file.iso bs=1M count=<the amount of free space you have in megabytes>

You will likely run out of space for a few seconds at the very end of the file creation, as soon as you get your disk full error, delete the file, shutdown the machine and image from a linux live disk with

dd if=</dev/disc_to_be_imaged> of=file_on_third_disk bs=1M

the "bs=" flag roughly dictates your performance, depending on the kind of storage bus you're using, you might want to try higher values, 1M block size is reasonable on pretty much any hardware and it is fast enough for sub-terabyte sizes.

I can add details to the answer if you need to dig deeper before trying it, but this is pretty much hassle-free. I use it on production SAP machines regularly.

EDIT:

Getting uneven feedback about the presence of /dev/zero on Solaris. If it's there, use that.

If it isn't, use

mkfile -v <number> g (where g stands for gigs, use m, k,b for smaller sizes) <filename>

This will create a zero-padded file which achieves the same result. (As far as the manpage goes, mkfile is a solaris wrapper around /dev/zero so it's literally the same technique in a different dress).

Example:

mkfile -v 100 g /root/zeropad.iso

This would create a 100 gigabytes file in /root called "zeropad.iso".

Hope this is helpful.

Solution 2

There are a lot of different options, but a quick and dirty method that I'm a fan of is just taking a tarball of the partitions you'd like to back up. This is helpful for the root partition usually, but I might recommend another solution for the data storage drive based on its size. If you're just interested in being able to setup and tear down repeatedly though, tarballs would probably work well.

This may be out of the scope of your question, but you might also consider a virtualized setup - using virtual machines can make setting up and reverting to restore points reeeeally easy.

Solution 3

UFS also has snapshot support: http://www.c0t0d0s0.org/archives/4328-Less-Known-Solaris-features-fssnap.html

So if you want to experiment with some new application, just create a snapshot on both the ZFS and UFS filesystems and tinker away. If you later want to undo any changes, you can revert to your previously created snapshot.

As for backups, zfs send allows you to make backups of each snapshot. You can also make each snapshot differential vs the previous snapshot to save disk space: http://www.aisecure.net/2011/06/27/zfs-backups-with-differential-snapshots/

For UFS you have the ufdsump utility: http://www.tech-recipes.com/rx/1384/backup-a-unixsolaris-ufs-filesystem-with-ufsdump/

Share:
8,726

Related videos on Youtube

nonot1
Author by

nonot1

Updated on September 18, 2022

Comments

  • nonot1
    nonot1 almost 2 years

    I've got a Solaris 10 workstation that I'd like to create a full image backup from. The machine has 2 drives, one UFS for system root, and 1 ZFS for data storage.

    I intend to add a third HD to keep the backup images of both primary drives (including any zfs snapshots). The purpose is not disaster recovery, but rather to allow me to easily blow away a series of application installation/configuration changes I intend to try.

    What's the best way to do this? I'm not too familiar with Solaris, but have some basic Linux knowledge.

    I looked at CloneZilla, but it does not support Solaris. I'm OK with just a dd | gzip > image style solution, but I'd need some way to first zero-out the non-used blocks on the primary drives to aid gzip. They are are much larger than my 3rd drive, but hardly have any real data.

    Update to clarify:

    1. I specifically want to avoid using any file-system snapshot functionality, because part of the app configuration changes involve/depend slightly on existing and new snapshots. Ideally the full collection of snapshots should be part of the backup.

    2. Virtualization not an option, because the goal is to do performance evaluation on a very specific HW configuration. For the same reason, the spurious "back up" snapshots could skew performance data.

    Thank you