From owner-freebsd-questions@FreeBSD.ORG Sat May 30 01:22:20 2015 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 48B496AA for ; Sat, 30 May 2015 01:22:20 +0000 (UTC) (envelope-from dnewman@networktest.com) Received: from mail5.networktest.com (mail5.networktest.com [204.109.60.142]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 153051256 for ; Sat, 30 May 2015 01:22:19 +0000 (UTC) (envelope-from dnewman@networktest.com) Received: from localhost (localhost [127.0.0.1]) by mail5.networktest.com (Postfix) with ESMTP id 473F739DC33 for ; Fri, 29 May 2015 18:22:18 -0700 (PDT) Received: from mail5.networktest.com ([127.0.0.1]) by localhost (mail5.networktest.com [127.0.0.1]) (maiad, port 10024) with ESMTP id 21144-03 for ; Fri, 29 May 2015 18:22:18 -0700 (PDT) Received: from tejay-2.local (cpe-75-82-83-187.socal.res.rr.com [75.82.83.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: dnewman@networktest.com) by mail5.networktest.com (Postfix) with ESMTPSA id E3E7739DC25 for ; Fri, 29 May 2015 18:22:17 -0700 (PDT) Message-ID: <556910C9.7010706@networktest.com> Date: Fri, 29 May 2015 18:22:17 -0700 From: David Newman User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: freebsd-questions@freebsd.org Subject: Re: Missing boot loader References: <5522C5DE.1050005@networktest.com> <55687BE9.40803@networktest.com> <556898FB.1080704@networktest.com> In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 May 2015 01:22:20 -0000 On 5/29/15 12:22 PM, Warren Block wrote: > On Fri, 29 May 2015, David Newman wrote: > >> On 5/29/15 8:46 AM, Warren Block wrote: >>> On Fri, 29 May 2015, David Newman wrote: >>> >>>> On 4/6/15 9:28 PM, Olivier Nicole wrote: >>>> >>>>> My solution is >>>>> http://www.cs.ait.ac.th/~on/technotes/archives/2015/01/30/how-to_clone_a_freebsd_virtual_machine_on_vmware/index.html >>>>> >>>>> >>>>> certainly not the best/fastest, but it works. >>>> >>>> Thanks for this. After following the clone instructions, restore >>>> appears >>>> to work, but the system comes up with a "Missing boot loader" error. >>>> >>>> This is perhaps because the next-to-last step from the live CD is: >>>> >>>> cd / >>>> mount -o rw /dev/da0p1 /mnt >>>> gpart bootcode -b /mnt/boot/pmbr -p /mnt/boot/gptboot -i 1 da0 >>>> >>>> And that returns "/dev/da0p1: Operation not permitted" even though >>>> da0p1 >>>> is the target system's root/boot partition. >>> >>> In this code, da0 is the source disk, where the bootcode files are read. >>> It is mounted on /mnt. So there are two reasons that gpart cannot write >>> bootcode to da0p1. First, it is mounted, and second, it is filesystem >>> partition, not a freebsd-boot partition. >>> >>> The target disk cannot be da0p1. Maybe it is a simple typo, and either >>> the second or third line was meant to be ada0 rather than da0. >> >> Thanks for your email. Backstory: This VM is a dump/restore clone of >> another machine that has no separate boot partition. Here's /etc/fstab >> from the source machine: >> >> /dev/ada0p2 / ufs rw 1 1 >> /dev/ada0p3 none swap sw 0 0 > > On a GPT disk, FreeBSD uses a freebsd-boot partition to hold the > bootcode. This is binary code written to that partition, which does not > have a filesystem. It does *not* contain /boot, which is instead part > of /. > > Because the freebsd-boot partition is not needed after boot, it is not > mentioned in /etc/fstab. Look at the output of 'gpart show' instead. > >> And on the new target VM: >> >> /dev/da0p1 / ufs rw 1 1 >> /dev/da0p2 none swap sw 0 0 > > This disk is mountable, but because there is no freebsd-boot partition, > it will not be bootable. (Well, it might be possible to add a > freebsd-boot partition after the existing partitions, but I'd avoid that > because it is unusual and may come back to haunt you at the worst > possible time.) > >> I don't understand the bit about 'ada0', since 'gpart list' shows only >> da0 and two providers under it. > > The original disk was ada0, the new one is da0. If the partitions had > been created properly on da0 (with p1 being the freebsd-boot partition), > it would be possible to mount da0p2 (/), read the bootcode from a file > in the /boot directory there, and write it to da0p1. > >> The source machine has boot files in its root partition, under /boot. > > Those are copies of the binary bootcode that must be written to a > freebsd-boot partition to make a disk bootable. > > Disk Setup On FreeBSD: > http://www.wonkity.com/~wblock/docs/html/disksetup.html Bingo. Thanks, Warren! I completely missed the necessity for a boot partition -- the fstab table and 'gpart show' output of the source machine should have been a clue. Remade the partitions, redid the restore, and now the target VM boots as expected. Thanks again! dn