From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1E3cGC-0003I9-3k for qemu-devel@nongnu.org; Fri, 12 Aug 2005 12:19:58 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1E3cG9-0003G5-Hz for qemu-devel@nongnu.org; Fri, 12 Aug 2005 12:19:55 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1E3cG9-0003F3-Ap for qemu-devel@nongnu.org; Fri, 12 Aug 2005 12:19:53 -0400 Received: from [65.74.133.11] (helo=mail.codesourcery.com) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1E3cQO-0000Tk-Qu for qemu-devel@nongnu.org; Fri, 12 Aug 2005 12:30:29 -0400 From: Paul Brook Subject: Re: [Qemu-devel] resize an image Date: Fri, 12 Aug 2005 17:15:16 +0100 References: <1E3TSq-1PqZhw0@fwd33.aul.t-online.de> <20050812153542.GA1502@jbrown.mylinuxbox.org> In-Reply-To: <20050812153542.GA1502@jbrown.mylinuxbox.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200508121715.18244.paul@codesourcery.com> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: "Jim C. Brown" On Friday 12 August 2005 16:35, Jim C. Brown wrote: > On Fri, Aug 12, 2005 at 08:56:24AM +0200, MichaelHoeller@t-online.de wrote: > > Hello, > > > > I did create some time ago an 2GB image via dd. Now I have to realize > > that I on ly ndeed 1,1 GB is there a way to shrink the sizes of my > > image? > > > > Thanks a lot > > Michael > > This is unusual. Most people ask if they can enlarge them. > > The easy way, if you are using raw format, is just to use dd to make the > smaller sized file and then fix the partition table. A defrag might be > helpful. Probably a good idea to shrink the partition _before_ you shrink the image and discard all the data in that half of the disk :-) > The hard way is to make a new blank disk image of the right size, and then > to create the partition table and file systems in the new disk image, and > then copy everything over. I'd argue this is actually the easy way. It's certainly much safer than trying to resize partitions in place. You can pass both images to qemu (using -hdb), use conventional migration tools within the guest, then just switch the images. Paul