How to back up a ZFS boot disk ?

Hello all,
I have just installed Solaris 10 update 6 (10/08) on a Sparc machine (an Ultra 45 workstation) using ZFS for the boot disk.
Now I want to port a custom UFS boot disk backup script to ZFS.
Basically, this script copies the boot disk to a secondary disk and makes the secondary disk bootable.
With UFS, I had to play with the vfstab a bit to allow booting off the secondary disk, but this is not necessary with ZFS.
How can I perform such a backup of my ZFS boot disk ?
I tried the following (source disk: c1t0d0, target disk: c1t1d0):
# zfs list
NAME USED AVAIL REFER MOUNTPOINT
rpool 110G 118G 94K /rpool
rpool/ROOT 4.58G 118G 18K legacy
rpool/ROOT/root 4.58G 25.4G 4.50G /
rpool/ROOT/root/var 79.2M 4.92G 79.2M /var
rpool/dump 16.0G 118G 16.0G -
rpool/export 73.3G 63.7G 73.3G /export
rpool/homelocal 21.9M 20.0G 21.9M /homelocal
rpool/swap 16G 134G 16K -
# zfs snapshot -r rpool@today
# zpool create -f -R /mnt rbackup c1t1d0
# zfs send -R rpool@today | zfs receive -F -d rbackup               <- This one fails (see below)
# installboot /usr/platform/`uname -i`/lib/fs/zfs/bootblk /dev/rdsk/c1t1d0s0
The send/receive command fails after transfering the "/" filesystem (4.5 GB) with the following error message:
cannot mount '/mnt': directory is not empty
There may be some kind of unwanted recursion here (trying to back up the backup or something) but I cannot figure it out.
I tried a workaround: creating the mount point outside the snapshot:
zfs snapshot -r rpool@today
mkdir /var/tmp/mnt
zpool create -f -R /var/tmp/mnt rbackup c1t1d0
zfs send -R rpool@today | zfs receive -F -d rbackup
But it still fails, this time with mounting "/var/tmp/mnt".
So how does one back up the ZFS boot disk to a secondary disk in a live environment ?

OK, this post requires some clarification.
First, thanks to robert.cohen and rogerfujii for giving some elements.
The objective is to make a backup of the boot disk on another disk of the same machine. The backup must be bootable just like the original disk.
The reason for doing this instead of (or, even better, in addition to) mirroring the boot disk is to be able to quickly recover a stable operating system in case anything gets corrupted on the boot disk. Corruption includes hardware failures, but also any software corruption which could be caused by a virus, an attacker or an operator mistake (rm -rf ...).
After doing lots of experiments, I found two potential solutions to this need.
Solution 1 looks like what rogerfujii suggested, albeit with a few practical additions.
It consists in using ZFS mirroring and breaking up the mirror after resilvering:
     - Configure the backup disk as a mirror of the boot disk :
     zpool attach -f rpool <boot disk>s0 <backup disk>s0
     - Copy the boot block to the backup disk:
     installboot -F zfs /usr/platform/`uname -i`/lib/fs/zfs/bootblk /dev/rdsk/<backup disk>s0
     - Monitor the mirror resilvering:
     zpool status rpool
     - Wait until the "action" field disappears (this can be scripted).
     - Prevent any further resilvering:
     zpool offline rpool <backup disk>s0
     Note: this step is mandatory because detaching the disk without offlining it first results in a non bootable backup disk.
     - Detach the backup disk from the mirror:
     zpool detach rpool <backup disk>s0
     POST-OPERATIONS:
     After booting on the backup disk, assuming the main boot disk is unreachable:
     - Log in as super-user.
     - Detach the main boot disk from the mirror
     zpool detach rpool <boot disk>s0
This solution has many advantages, including simplicity and using no dirty tricks. However, it has two major drawbacks:
- When booting on the backup disk, if the main boot disk is online, it will be resilvered with the old data.
- There is no easy way to access the backup disk data without rebooting.
So if you accidentally lose one file on the boot disk, you cannot easily recover it from the backup.
This is because the pool name is the same on both disks, therefore effectively preventing any pool import.
Here is now solution 2, which I favor.
It is more complex and dependent on the disk layout and ZFS implementation changes, but overall offers more flexibility.
It may need some additions if there are other disks than the boot disk with ZFS pools (I have not tested that case yet).
***** HOW TO BACKUP A ZFS BOOT DISK TO ANOTHER DISK *****
1. Backup disk partitioning
- Clean up ZFS information from the backup disk:
The first and last megabyte of the backup disk, which hold ZFS information (plus other stuff) are erased:
dd if=/dev/zero seek=<backup disk #blocks minus 2048> count=2048 of=/dev/rdsk/<backup disk>s2
dd if=/dev/zero count=2048 of=/dev/rdsk/<backup disk>s2
- Label and partition the backup disk in SMI :
format -e <backup disk>
     label
     0          -> SMI label
     y
     (If more questions asked: press Enter 3 times.)
     partition
     (Create a single parition, number 0, filling the whole disk)
     label
     0
     y
     quit
     quit
2. Data copy
- Create the target ZFS pool:
zpool create -f -o failmode=continue -R /mnt -m legacy rbackup <backup disk>s0
Note: the chosen pool name is here "rbackup".
- Create a snapshot of the source pool :
zfs snapshot -r rpool@today
- Copy the data :
zfs send -R rpool@today | zfs receive -F -d rbackup
- Remove the snapshot, plus its copy on the backup disk :
zfs destroy -r rbackup@today
zfs destroy -r rpool@today
3. Backup pool reconfiguration
- Edit the following files:
/mnt/etc/vfstab
/mnt/etc/power.conf
/mnt/etc/dumpadm.conf
In these files, replace the source pool name "rpool" with the backup pool name "rbackup".
- Remove the ZFS mount list:
rm /mnt/etc/zfs/zpool.cache
4. Making the backup disk bootable
- Note the name of the current boot filesystem:
df -k /
E.g.:
# df -k /
Filesystem kbytes used avail capacity Mounted on
rpool/ROOT/root 31457280 4726390 26646966 16% /
- Configure the boot filesystem on the backup pool:
zpool set bootfs=rbackup/ROOT/root rbackup
Note: "rbackup/ROOT/root" is derived from the main boot filesystem name "rpool/ROOT/root".
- Copy the ZFS boot block to the backup disk:
installboot -F zfs /usr/platform/`uname -i`/lib/fs/zfs/bootblk /dev/rdsk/<backup disk>s0
5. Cleaning up
- Detach the target pool:
zpool export rbackup
I hope this howto will be useful to those like me who need to change all their habits while migrating to ZFS.
Regards.
HL

Similar Messages

  • How do I create a new boot disk from an existing one?

    I have a G4 Quicksilver with internal PATA disk, running 10.4. I want to upgrade the internal disk from 40 GB to 160 GB. I have installed a second disk and can see it fine, but what I really want is to put the system on the new disk and have it be the one and only boot disk in the system. Is there a straightforward way to do this? Is a carbon copy cloner the way to go? Will that have problems with the different disk sizes? Will it handle bad blocks properly? Isn't there a way to just use drag-and-drop?
    Once I have made a copy, how do I make it the boot disk? Do I have to swap it into the PATA "master" position to do this?

    Cloning And Backup Tools
    A bootable clone is an exact copy of your drive which is capable of booting your computer. Making a copy of your computer which is capable of actually starting the computer requires special copying procedures. Some people just back up data files but if you have problems you have to reinstall all your operating system and all your applications. With a bootable clone you just start up from the backup drive and clone back everything.
    To copy files from one hard drive to another hard drive you can use:
    [CarbonCopy Cloner|http://www.bombich.com/software/ccc.html] (donationware)
    [SuperDuper|http://www.shirt-pocket.com/SuperDuper/SuperDuperDescription.html] (shareware)
    [IBackup|http://www.grapefruit.ch/iBackup/index.html] (free)
    The Restore function of Disk Utility included in OS X. [Kappy's directions|http://discussions.apple.com/message.jspa?messageID=8799711#8799711]
    [Tri-Backup (commercial)|http://www.tri-edre.com/english/tribackup.html] (payware)
    [Silverkeeper|http://www.lacie.com/silverkeeper> (free) - version 2 has some issues (references: [1|http://www.macintouch.com/readerreports/backup/index.html#d12jan2009],
    [2|http://www.macintouch.com/readerreports/backup/index.html#d13jan2009]) and it is recommended Tiger users stick with 1.1.4.
    [Kappy's Backup Software Recommendations|http://discussions.apple.com/message.jspa?messageID=9065665#906 5665]
    [Overview of Mac OS X Backup Programs|http://8help.osu.edu/1247.html]

  • How can I partition, clone the boot disk, no cd?

    How am I going to partition my boot disk? I only have the OS that came on the hard drive, no cd.
    Tried start up c key on tiger 10.4 but it did not start from that cd where I thought perhaps I could administer this partitioning.
    And further, how can I clone once done, no cd.

    Let me see if I have this straight:
    You want to partition your boot disk. That's it right?
    All you need to do is clone your boot drive to another partition, disk, external, etc. You can use either superduper! (recommended), carbon copy cloner, or even just use osx disk utility.
    http://www.shirt-pocket.com/SuperDuper/SuperDuperDescription.html
    http://www.macupdate.com/info.php/id/7032/carbon-copy-cloner
    Once you clone your boot drive, make sure it boots up first. Then if everything is good, re-partition the boot disk (erase) into however many partitions you need in Disk utility.
    Then boot up from your clone you just made, open for example superduper, and clone back to your new partitioned drive. Bootup from the new partition drive, and you are set.
    You don't need the CD to partition or even clone using DU.

  • How can I create an OSX boot-disk from my Windows PC? (or alternatives)

    Hi all,
    I've got a Macbook Pro and I had recently upgraded OSX from 10.9 to 10.10 beta. Without thinking it all the way through, I decided to perform a complete reformat to remove any files left over from the previous version upgrades. So, I rebooted and held cmd button + R, and I erased the main partition. The option to install a copy of OSX 10.10 fails because I'm assuming it's not on Apple's servers, yet, since it's still beta. The problem is, I cannot choose to install 10.9 from that screen - it only offers 10.10. I can no longer boot into OSX, since I erased the partition.
    So, I'm now on my Windows machine trying to find the proper way to recover this Macbook Pro. It sounds like I need to create a boot disk, but I can't find an official way to get a hold of the ISO to create that boot disk.
    What can I do in this situation? I don't want to have to go into an Apple store, because I live a long way away from one. Is there a way I can obtain an ISO to create the boot disk? Or, is there maybe a way to simply choose a different OSX version at that reformat screen?
    Thanks!

    I don't think you can do anything helpful with a Windows machine. Mac App store wants to read your Mac's model number and your Apple-ID.
    Exactly which model MacBook Pro makes a big difference.
    If yours has Internet Recovery, you should be able to hold down:
    Command-Option-R
    at startup until a globe appears on your screen. From there, you should be able to re-Install Mac OS X, and it is supposed to be the version that came on your Mac.
    Please post back with your results, because some Readers are saying it re-installs the Major version, but the latest 0.1 update to that version. Others are saying if your Mac can run Mavericks, it re-Installs Mavericks 10.9.3 regardless.

  • How  do I change the Win7 boot disk under BootCamp?

    I have been getting warnings that my Window7Pro64 hard disk may crash.  I bought a new disk.  Installed it in my Mac Pro. Set up the partitions and cloned my boot disk to the new disk.  At the end of the process of creating the clone, the software will shut the computer down.  I am instructed to enter the Bios in order to assign the Clone disk as the new 'boot' disk.
    Since I am running under Boot Camp I am wondering if I need to follow another procedure?  I am inquiring before the cloning process has completed, so I haven't tried rebooting into Bios...
    Thanks for any insight...!
    Jim

    So, Mr. Hatter...
    You have raised some additional questions:
    1.  Will Boot Camp now support Windows 8?
    2.  On the Windows side of Boot Camp I have installed Acronis software to clone my old boot disk (500GB) to a new clone disk (1TB).  That cloning process worked.  I rebooted to the Mac side.  I chose Boot Camp and chose to reboot into Windows 7 using the new clone disk.  Windows booted up.  It appears to me that I now have two Windows bootable disks.  Is this correct?  Does this create any potential problems?
    3. On the Mac side of Boot Camp, I have installed Carbon Copy to clone my old boot disk (500GB) to a new Clone disk (1TB).  That cloning also appears to have worked.  It appears I now have two bootable disks on the Mac side, too.  Any problems with that?
    4. Inside my MacPro my 4 drive bays are currently assigned disks in the following order (reading from the left side of the compartment): Drive Bay 1: MacBoot (500GB); Drive Bay 2: WinClone (1TB); Drive Bay 3: MacClone (1TB); Drive Bay 4: WinBoot (500GB).  The reason I ask is because when I go into Acronis / Carbon Copy they report the disks as Primary Master / Primary Slave; and Secondary Master / Secondary Slave without regard to their physical locations.  This is suggesting the master / slave relationship may need to be maintained physically - in which case my allocation of disks to bays would be incorrect.  Any insight on this topic may reduce my anxiety that I could be causing a disk failure (I had a new 1TB disk indicate a mechanical failure and replaced it with the current, new MacClone (1TB) disk.  It is in the same bay relationship.  This got me thinking... is it possible to have a Mac disk as Primary Master and a Win disk as its Primary Slave?  If so, what damage might result).
    In any case, at the moment, everything seems to be functional on both sides (Mac & Win).  However, I rarely come out of these exercises with a complete sense of security that I have done everthing correctly...
    5.  Should I still run CHKDSK?  How do I invoke it?
    6.  What is NVRAM and how do I invoke it?  Does it apply to both Win & Mac?
    7.  Still boot from Win7 DVD and run system repairs?
    Sorry to burn your ears, but its on my mind and since you guys have sooo... many 'help' points I figured I tapped into serious capabilities I should not pass up!
    Thanks, again
    Jim

  • CLUSTERING WITH ZFS BOOT DISK

    hi guys,
    i'm looking for create a new cluster on two standalone server
    the two server boot with a rpool zfs, and i don't know if in installation procedure the boot disk was layered with a dedicated slice for global device.
    Is possible to install SunCluster with a rpool boot zfs disk?
    What do i have to do?
    Alessio

    Hi!
    I am have 10 node Sun Cluster.
    All nodes have zfs rpool with mirror.
    is better create mirror zfs disk boot after installation of Sun Cluster or not?I create zfs mirror when install Solaris 10 OS.
    But I don't see any problems to do this after installation of Sun Cluster or Solaris 10.
    P.S. And you may use UFS global with ZFS root.
    Anatoly S. Zimin

  • How to back up a external hard disk to time capsule?

    I have a external hard disk (WD passport Mac OS extended format)  connected to iMAC (OS X 10.9.3) through USB. How can I back up the hard disk to my time capsule (802.11ac 2TB)?

    By default, the name of the hard drive will appear on the list of Excluded items when you open System Preferences / Time Machine  / Options.
    Click on the name of the hard drive to highlight it, and then click on the - (minus) button at the bottom of the Exclusions list to remove the drive from the list of items that are Excluded on backups.
    Time Machine will back up both your Mac and the hard drive on the next pass.

  • How do I restore an entire boot disk from time machine?

    This used to be an option on the older system installers "Restore from time machine backup." I don't see this with the ML installer.

    See How do I restore my entire system?

  • How do I make an OSX boot disk

    I recently bought a Mid 2011 Mac Mini off my brother (because the new Late 2012 Mac Mini I bought has a quite a few bugs - see this thread) and would like to do a fresh install of Mountain Lion. Problem is there's no "Install OS X Mountain Lion.app" in the /Applications folder. He did pay for it to upgrade it on the Mac Mini, but when I go to the App Store to download it, it wants me to pay another $20.99 for it. He's now using a new 15" Retina Macbook Pro which already comes with Mountain Lion, so the license for it he bought for this Mac Mini isn't being used anywhere else, so there's no piracy going on.
    How can I do a fresh install of OS X and make a backup USB stick so that I have it in case things go wrong again? It's crashing something shocking lately, even though my brother has already reinstalled OS X somehow.
    Thanks.

    Unlike the old days when possession of the installer DVD gave you right to the system copy, now with downloads the license remains with the purchaser of the software even if the computer is passed on.  In other words, you will have to buy your own copy of Mountain Lion since to download it and install it you have to be logged onto an Apple account used to purchase the software.

  • How to create a Lion boot disk for Lion on a MBPRD?

    I have a unique version of Lion on my MBPRD.  How do I create a Lion Boot Disk for this unique version?

    Why is it a Unique version of Lion? The only versions of Lion are ones for older Macs, Before the Mid 2012 models came out, and a version that includes the newer drivers for the newest model Macs, Current shipping Mid 2012 models.
    If you are talking about a version for the new Mid 2012 models then you will need to wait for Apple to update their Lion Download servers because right now they do not have the newest Lion version available on those servers.

  • Enyone know how to get USB stick back to normal after creating a USB boot disk for Mavericks?

    Enyone know how to get USB stick back to normal after creating a USB boot disk for Mavericks? https://discussions.apple.com/message/23527458#23527458

    You should just be able to erase it using Disk Utiilty. I did with my 8Gb.
    If not I have a USB deep format tool, but it only works with Windows: http://tinyurl.com/mwor6s9
    You can download that and unzip it, then run it on a PC to fully erase and format the flash drive. Format it in FAT, and then the Mac will read and mount it so you cna once again format it with HFS extended for Mac use.

  • HT1199 After trying to install window 7 my new iMac will not reboot back to apple. Black screen "No bootable device -- insert boot disk and press any key". How do I get out of this?

    After trying to install Windows 7 in my new iMac It will not boot up back to Apple. I have a black screen with the following "No bootable device -- insert boot disk and press any key". My iMac did not come with a boot disk. What can I do?

    Try holding down the option/alt key during a restart and see if you can see/select your boot drive there.

  • My caps lock was stuck and I shut down. Now it's coming back up in safe boot and asking for a password. It won't take my password, I believe because of the caps lock problem. So, how can I get in?

    My caps lock was stuck when I shut down my computer. It is coming back up in safe boot (I had spilled liquid on it).
    It's asking for my password - which has some lower case letters...So now how can I get in?
    Is there a way to change this password or something?
    I have a wireless keyboard, but it wasn't set up - so, It's not recognizing it.
    Any ideas?

    Take your computer to get the keyboard replaced, your lucky it didn't trigger the moisture sensor and brick your machine, so your chances of the machine working well after the keyboard is replaced is likely very good.
    As long as the main keyboard is sending a caps lock signal, it's not going to work even if you get in.
    If you need to remove files off the internal drive, use a Firewire cable (800 to 400 adpater may be needed) and hold T to boot the problem Mac into Firewire Target Disk Mode and connect the cable to another Mac, the hard drive will appear on the desktop which you can then remove/erase files.

  • How do change boot disk from single user mode?

    My G5 hangs when booting at the blue screen while "Loading printing services...". Attempting to boot into safe mode only hangs at the grey gear screen. It will, however, successfully boot into single user mode. I've run fsck but no change in bootability. I have another disk in the machine that has Tiger on it. How do I change the boot disk from the single user prompt?

    You can hold c and boot off the installer disk and select disk utility repair disk/permissions
    or you can hold option to boot off Mac OS X on another drive, like a clone and run Data Rescue to recvoer your files.
    It does sound bad, you can try going through these
    http://docs.info.apple.com/article.html?artnum=106464
    But I think you'll need a fresh install, hopefully you have been backing up/cloning to a external drive.
    http://homepage.mac.com/hogfish/Personal11.html

  • IMac won't launch, disk utility says I cannot repair my Macintosh HD, back up files, reformat the disk and restore backed up files. How do I do all that? Help!

    iMac won't start up, disk utility tried to repair disk it shows "keys out of order" error message in red and advises me to back up files, reformat disk and restore backed up files. I have no idea how to back up and restore etc... Help! Please!

    Get an external drive of sufficient capacity to hold everything on your internal drive.
    Partition and format the external drive.
    Drive Partition and Format
    1. Open Disk Utility in your Utilities folder.
    2. After DU loads select your hard drive (this is the entry with the mfgr.'s ID and size) from the left side list. Click on the Partition tab in the DU main window.
    3. Under the Volume Scheme heading set the number of partitions from the drop down menu to one. Click on the Options button, set the partition scheme to GUID then click on the OK button. Set the format type to Mac OS Extended (Journaled.) Click on the Apply button and wait until the process has completed.
    4. Select the volume you just created (this is the sub-entry under the drive entry) from the left side list. Click on the Erase tab in the DU main window.
    5. Set the format type to Mac OS Extended (Journaled.) Click on the Security button, check the button for Zero Data and click on OK to return to the Erase window.
    6. Click on the Erase button. The format process can take up to several hours depending upon the drive size.
    Clone your internal drive to the external drive.
    Clone Mavericks, Lion/Mountain Lion using Restore Option of Disk Utility
    Boot to the Recovery HD:
    Restart the computer and after the chime press and hold down the COMMAND and R keys until the menu screen appears. Alternatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button.
         1. Select Disk Utility from the main menu then press the Continue
             button.
         2. Select the destination volume from the left side list.
         3. Click on the Restore tab in the DU main window.
         4. Select the destination volume from the left side list and drag it
             to the Destination entry field.
         5. Select the source volume from the left side list and drag it to
             the Source entry field.
         6. Double-check you got it right, then click on the Restore button.
    Destination means the external backup drive. Source means the internal startup drive.
    Boot from the external drive.
    Boot Using OPTION key:
      1. Restart the computer.
      2. Immediately after the chime press and hold down the
          "OPTION" key.
      3. Release the key when the boot manager appears.
      4. Select the external disk icon from which you want to boot.
      5. Click on the arrow button below the icon.
    Reformat the internal drive and install OS X.
    Install or Reinstall Mavericks, Lion/Mountain Lion from Scratch
    Boot to the Recovery HD:
    Restart the computer and after the chime press and hold down the COMMAND and R keys until the menu screen appears. Alternatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button.
    Erase the hard drive:
      1. Select Disk Utility from the main menu and click on the Continue button.
      2. After DU loads select your startup volume (usually Macintosh HD) from the
          left side list. Click on the Erase tab in the DU main window.
      3. Set the format type to Mac OS Extended (Journaled.) Optionally, click on
          the Security button and set the Zero Data option to one-pass. Click on
          the Erase button and wait until the process has completed.
      4. Quit DU and return to the main menu.
    Reinstall Lion/Mountain Lion, Mavericks: Select Reinstall Lion/Mountain Lion, Mavericks and click on the Install button.
    Note: You will need an active Internet connection. I suggest using Ethernet if possible
                because it is three times faster than wireless.
    Open Startup Disk preferences and set the internal drive as the startup volume, then click on the Restart button.
    Restore your data from your external drive backup.

Maybe you are looking for

  • USER DEFINED FUNCTION in the formula editor

    How do you create a USER DEFINED FUNCTION in the formula editor using BADI

  • PDF appears black in Preview

    Okay.  I have OSX 10.7.4. I have Adobe Reader 10.3.1 (latest version). When I look at the pdf online, it looks fine.  When I open a different PDF that's on my Mac, it looks fine. When I open the PDF I want to print from the net, I click File-Print, a

  • Nested query doesn't return result

    Using CF 8.1.  First field in table is "item" which is a compound filed containing a five digit customer number, a space, then a six digit item number.  I need to produce a list of items for a specific customer based on their customer number, which i

  • Extra blank rows in vba spreadsheet zoom

    Here's how it happens: - in Excel 2003 VBA - two row dims - right row dim is fixed list of mbrs - left row dim is single member zoom - sheet has other stuff on it, so retrieve range is not entire sheet - top of retrieve range is in row 6 so when I ca

  • Create transfer order without stock

    Hi, I have a requirement were I need to create transfer orders without stock, can we create this using the user exits (MWMTO005, MWMTO001, MWMTO002). is there anyother way of creating TO without stock by turning off ATP? we need this for cross dockin