Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Jul 2005 02:54:28 -0700
From:      Glenn Dawson <glenn@antimatter.net>
To:        alexandre.delay@free.fr, freebsd-questions@freebsd.org
Subject:   Re: resizing virtual disk (vn0)
Message-ID:  <6.1.0.6.2.20050725024754.106a6340@cobalt.antimatter.net>
In-Reply-To: <1122284169.42e4b2893a1eb@imp6-q.free.fr>
References:  <1122284169.42e4b2893a1eb@imp6-q.free.fr>

next in thread | previous in thread | raw e-mail | index | archive | help
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?

You can create an empty file that's as big as the space you want to add 
(using dd).  Then concatenate the empty file to the end of the file that 
contains the filesystem you need to make larger.  Then use disklabel to 
edit the size of the partition you are using to reflect the added 
space.  Then use growfs to expand the filesystem.

Depending on how big the filesystem is, it will save a lot of time over 
doing a dump and restore.

-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"




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6.1.0.6.2.20050725024754.106a6340>