contrib: More trace visualization.
[libguestfs.git] / contrib / visualize-alignment / README
1 This directory contains some experimental work for capturing traces of
2 block device operations while filesystem operations are performed.
3
4 You can trace any operation that libguestfs supports, including
5 partitioning, mkfs, LVM operations, and filesystem operations.  You
6 can enable and disable tracing in order to capture single operations
7 such as a single write, or groups of operations.  You can examine the
8 traces by hand (as text files) or turn them into graphical
9 visualizations.
10
11 The *.qtr files are qemu trace files, produced using the unofficial
12 qemu patch in the current directory.
13
14 - guestfish-N-fs-10M.qtr
15
16   The command 'guestfish -N fs:ext2:10M' before we modified the
17   part-disk API to align the partition to 64 sectors.
18
19 - guestfish-N-fs-10M-aligned-part-disk.qtr
20
21   The command 'guestfish -N fs:ext2:10M' after we modified the
22   part-disk API to align the partition to 64 sectors.
23
24 - guestfish-add-mount.qtr
25
26   $ guestfish -a test1.img -m /dev/sda1
27   where test1.img was created by the previous command.
28
29 - guestfish-write-hello.qtr
30
31   $ guestfish -a test1.img -m /dev/sda1 \
32       debug qtrace "/dev/vda on" : \
33       write /hello "hello, world." : \
34       debug qtrace "/dev/vda off"
35   where test1.img was created by the command above.
36
37   This is just the creation of a new file with a small amount of content.
38
39   Within this trace file, the qtrace on/off commands appear as patterns
40   of reads.  For on: 2, 21, 15, 2.  For off: 2, 15, 21, 2.
41
42 - guestfish-lv-ext4-4k.qtr
43
44   $ guestfish \
45       alloc test1.img 40M : \
46       run : \
47       part-disk /dev/vda mbr : \
48       pvcreate /dev/vda : \
49       vgcreate VG /dev/vda : \
50       lvcreate LV VG 32 : \
51       mkfs-b ext4 4096 /dev/VG/LV
52
53   Some points to note:
54     * an ext4 filesystem, so it has a journal and extents
55     * 4K block size, so we expect writes to be aligned
56     * located inside an LV, so more realistic
57
58 - guestfish-lv-ext4-4k-write-hello.qtr
59
60   $ guestfish -a test1.img -m /dev/VG/LV \
61       debug qtrace "/dev/vda on" : \
62       write /hello "hello, world." : \
63       debug qtrace "/dev/vda off"
64   where test1.img was created by the previous command.