From owner-freebsd-virtualization@FreeBSD.ORG Tue Apr 22 21:48:27 2014 Return-Path: Delivered-To: freebsd-virtualization@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BADCF9F7 for ; Tue, 22 Apr 2014 21:48:27 +0000 (UTC) Received: from mail.monkeybrains.net (mail.monkeybrains.net [208.69.40.19]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A225811C2 for ; Tue, 22 Apr 2014 21:48:27 +0000 (UTC) Received: from [10.6.35.14] (199-188-192-168.PUBLIC.monkeybrains.net [199.188.192.168]) (authenticated bits=0) by mail.monkeybrains.net (8.14.7/8.14.7) with ESMTP id s3MLeCOG015439 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO) for ; Tue, 22 Apr 2014 14:40:12 -0700 (PDT) (envelope-from crapsh@monkeybrains.net) X-Authentication-Warning: mail.monkeybrains.net: Host 199-188-192-168.PUBLIC.monkeybrains.net [199.188.192.168] claimed to be [10.6.35.14] Message-ID: <5356E1BC.7060802@monkeybrains.net> Date: Tue, 22 Apr 2014 14:40:12 -0700 From: Rudy User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: freebsd-virtualization@freebsd.org Subject: HOW-TO resize a .img Ubuntu guest Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.98.1 at mail.monkeybrains.net X-Virus-Status: Clean X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Apr 2014 21:48:27 -0000 Cloning images and growing them. We have a 'standard install' image called, 'ubuntu14-clone-me.img'. To copy, enlarge, and then grow the guest image size, we use the process below. Let's take an Ubuntu image (ubuntu14-clone-me.img), clone it, grow the system, then log into the Ubuntu guest (vm12) and resize the / partition (all our guests are single partition). In FreeBSD: FreeBSD# gcp --sparse=always ubuntu14-clone-me.img vm12.img FreeBSD# truncate -s 300g vm12.img Launch guest with bhyve, get on console, and use these commands: Guest-VM# swapoff -a Guest-VM# fdisk /dev/vda hit 'p' to print existing table delete all the paritions recreate partition '1' with same stating block noted in the 'print' make end block near end but with enough room for your swap create an extended parition '5' and put the rest in there for guest swap Guest-VM# reboot Guest-VM# resize2fs /dev/vda1 Done! Pro tip: research sparse files, install gcp (pkg install coreutils). Rudy MonkeyBrains.net Local ISP