Tell me how to increase the virtual disk with ZFS?

Ronald Klop ronald-freebsd8 at klop.yi.org
Sun May 12 10:49:06 UTC 2013


On Sat, 11 May 2013 17:11:46 +0200, Vladislav Prodan <universite at ukr.net>  
wrote:

>
>
>> # zfs list md1p1
>> NAME    USED  AVAIL  REFER  MOUNTPOINT
>> md1p1   126K  1.96G    31K  /md1p1
>>
>> -- on-line resize partition to occupy added disk space
>> # sysctl kern.geom.debugflags=16
>> kern.geom.debugflags: 0 -> 16
>> # gpart recover md1
>> md1 recovered
>> # gpart resize -i 1 md1
>> md1p1 resized
>> # sysctl kern.geom.debugflags=0
>> kern.geom.debugflags: 16 -> 0
>>
>> -- tell zfs about it
>> # zpool online -e md1p1 md1p1
>>
>> -- done
>> # zfs list md1p1
>> NAME    USED  AVAIL  REFER  MOUNTPOINT
>> md1p1   136K  9.84G    31K  /md1p1
>>
>
> Can repeat resize the flag [-s size], so it was clearly indicate the  
> amount of increase in partition?
> Can you putting a pair small files in /md1p1?
> And compare md5 and sha256 these files before and after the resize md1?
>
> Thank you in advance.
>
>
>
>
>

I guess md1 is a memory disk. See mdconfig(8). So it is quite easy (and  
cheap) to experiment with it.
The same example, but with the creation of a memory disk.

# dd if=/dev/zero of=/data/prut/memdisk1 bs=1M count=1024
# mdconfig -f /data/prut/memdisk1 -u 0
# gpart create -s gpt /dev/md0
# gpart add -t freebsd-zfs -s 512m /dev/md0 <-- -s 512m is smaller than  
the virtual disk
# zpool create testpool md0p1
# df -h /testpool
Filesystem    Size    Used   Avail Capacity  Mounted on
testpool      471M     31k    471M     0%    /testpool
# sysctl kern.geom.debugflags=16
# gpart resize -i 1 md0
'If -s option is omitted then new size is automatically calculated to  
maximum available from given geom.'
# sysctl kern.geom.debugflags=0
# zpool online -e testpool md0p1
# df -h /testpool
Filesystem    Size    Used   Avail Capacity  Mounted on
testpool      983M     31k    983M     0%    /testpool

Ronald.


More information about the freebsd-fs mailing list