From owner-freebsd-questions@FreeBSD.ORG Mon Jul 25 10:26:39 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B001316A41F for ; Mon, 25 Jul 2005 10:26:39 +0000 (GMT) (envelope-from glenn@antimatter.net) Received: from cobalt.antimatter.net (cobalt.antimatter.net [69.55.224.239]) by mx1.FreeBSD.org (Postfix) with ESMTP id 779EA43D46 for ; Mon, 25 Jul 2005 10:26:37 +0000 (GMT) (envelope-from glenn@antimatter.net) Received: from glenn-mobile.antimatter.net (cpe-66-27-86-22.san.res.rr.com [66.27.86.22]) (authenticated bits=0) by cobalt.antimatter.net (8.13.4/8.13.4) with ESMTP id j6PAQZWB022312 (version=TLSv1/SSLv3 cipher=DES-CBC3-SHA bits=168 verify=NO); Mon, 25 Jul 2005 03:26:35 -0700 Message-Id: <6.1.0.6.2.20050725031219.0feaeeb0@cobalt.antimatter.net> X-Sender: lists@cobalt.antimatter.net X-Mailer: QUALCOMM Windows Eudora Version 6.1.0.6 Date: Mon, 25 Jul 2005 03:23:17 -0700 To: alexandre.delay@free.fr, freebsd-questions@freebsd.org From: Glenn Dawson In-Reply-To: <1122284169.42e4b2893a1eb@imp6-q.free.fr> References: <1122284169.42e4b2893a1eb@imp6-q.free.fr> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Cc: Subject: Re: resizing virtual disk (vn0) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jul 2005 10:26:39 -0000 At 02:36 AM 7/25/2005, alexandre.delay@free.fr wrote: >hi, > >I am searching how to resize a virtual disk created with: > > > # dd if=/dev/zero of=newimage bs=1k count=5k > 5120+0 records in > 5120+0 records out > # vnconfig -s labels -c vn0 newimage > # disklabel -r -w vn0 auto > # newfs vn0c > Warning: 2048 sector(s) in last cylinder unallocated > /dev/vn0c: 10240 sectors in 3 cylinders of 1 tracks, 4096 sectors > 5.0MB in 1 cyl groups (16 c/g, 32.00MB/g, 1280 i/g) > super-block backups (for fsck -b #) at: > 32 > # mount /dev/vn0c /mnt > >When I decide to add more space to this virtual disk, I would like to be >able to >resize it. > >The only solution I have is creating an other virtual disk and copy files >before >deleting the first one. It takes a long time and two time more space than >what I >want during the process. > >any idea? Here's a set of step by step instructions to go along with my previous reply: adding space to a vn backed filesystem unmount the file system to be enlarged # umount /foo unconfigure the vn node that needs to be enlarged # vnconfig -u /dev/vn0 *** MAKE A BACKUP of the file that was attached to the vn device # cp /path/to/oldfile /path/to/backup create a new file that's as big as the amount of space you want to add # dd if=/dev/zero of=addfile count=2000000 (2000000 blocks is 1GB) cat the original file and the new space into a new file # cat origfile addfile > newfile associate the new file with the vn device # vnconfig -u /dev/vn0 # vnconfig -s labels -c /dev/vn0 /path/to/newfile use disklabel to increase the size of the "disk" (you'll need to do a bit of math to get the right numbers, but make sure you edit the size of the disk and the size of the "c" partition) # disklabel -r -e vn0 now use growfs to enlarge the actual filesystem (size for growfs should match the size of the "c" partition when you edited the disklabel) # growfs -s 4000000 /dev/vn0c mount the newly enlarged filesystem # mount /dev/vn0c /some/path and that's it. -Glenn >Cheers > >Alex > >_______________________________________________ >freebsd-questions@freebsd.org mailing list >http://lists.freebsd.org/mailman/listinfo/freebsd-questions >To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"