1 | # $Id: tstVDCompact.vd 36635 2011-04-08 23:25:37Z vboxsync $
|
---|
2 | #
|
---|
3 | # Storage: Testcase for compacting disks.
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (C) 2011 Oracle Corporation
|
---|
8 | #
|
---|
9 | # This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | # available from http://www.virtualbox.org. This file is free software;
|
---|
11 | # you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | # General Public License (GPL) as published by the Free Software
|
---|
13 | # Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | # VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | # hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | #
|
---|
17 |
|
---|
18 | # Init I/O RNG for generating random data for writes
|
---|
19 | iorngcreate size=10M mode=manual seed=1234567890
|
---|
20 |
|
---|
21 | # Create zero pattern
|
---|
22 | iopatterncreatefromnumber name=zero size=1M pattern=0
|
---|
23 |
|
---|
24 | # Create disk containers, read verification is on.
|
---|
25 | createdisk name=disk verify=yes
|
---|
26 |
|
---|
27 | # Create the disk and close it.
|
---|
28 | create disk=disk mode=base name=tstCompact.vdi type=dynamic backend=VDI size=200M
|
---|
29 |
|
---|
30 | # Fill the disk with random data
|
---|
31 | io disk=disk async=no max-reqs=32 mode=seq blocksize=64k off=0-200M size=200M writes=100
|
---|
32 |
|
---|
33 | # Read the data to verify it once.
|
---|
34 | io disk=disk async=no max-reqs=32 mode=seq blocksize=64k off=0-200M size=200M writes=0
|
---|
35 |
|
---|
36 | # Fill a part with 0's
|
---|
37 | io disk=disk async=no max-reqs=32 mode=seq blocksize=64k off=100M-150M size=50M writes=100 pattern=zero
|
---|
38 |
|
---|
39 | # Now compact
|
---|
40 | compact disk=disk image=0
|
---|
41 |
|
---|
42 | # Read again to verify that the content hasn't changed
|
---|
43 | io disk=disk async=no max-reqs=32 mode=seq blocksize=64k off=0-200M size=200M writes=0
|
---|
44 |
|
---|
45 | # Cleanup
|
---|
46 | close disk=disk mode=single delete=yes
|
---|
47 | destroydisk name=disk
|
---|
48 | iopatterndestroy name=zero
|
---|
49 | iorngdestroy
|
---|
50 |
|
---|