daemon: debug segv correct use of dereferencing NULL.
[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 IMPORTANT NOTE: This is not upstream (in qemu) nor integrated into
12 libguestfs.  We should probably be using the 'blktrace' command
13 instead, or if that is not suitable, get a more reliable and useful
14 trace mechanism added to qemu (the current patch is not suitable for
15 upstreaming).
16
17 The *.qtr files are qemu trace files, produced using the unofficial
18 qemu patch in the current directory.
19
20 - guestfish-N-fs-10M.qtr
21
22   The command 'guestfish -N fs:ext2:10M' before we modified the
23   part-disk API to align the partition to 64 sectors.
24
25 - guestfish-N-fs-10M-aligned-part-disk.qtr
26
27   The command 'guestfish -N fs:ext2:10M' after we modified the
28   part-disk API to align the partition to 64 sectors.
29
30 - guestfish-add-mount.qtr
31
32   $ guestfish -a test1.img -m /dev/sda1
33   where test1.img was created by the previous command.
34
35 - guestfish-write-hello.qtr
36
37   $ guestfish -a test1.img -m /dev/sda1 \
38       debug qtrace "/dev/vda on" : \
39       write /hello "hello, world." : \
40       debug qtrace "/dev/vda off"
41   where test1.img was created by the command above.
42
43   This is just the creation of a new file with a small amount of content.
44
45   Within this trace file, the qtrace on/off commands appear as patterns
46   of reads.  For on: 2, 21, 15, 2.  For off: 2, 15, 21, 2.
47
48 - guestfish-lv-ext4-4k.qtr
49
50   $ guestfish \
51       alloc test1.img 40M : \
52       run : \
53       part-disk /dev/vda mbr : \
54       pvcreate /dev/vda : \
55       vgcreate VG /dev/vda : \
56       lvcreate LV VG 32 : \
57       mkfs-opts ext4 /dev/VG/LV blocksize:4096
58
59   Some points to note:
60     * an ext4 filesystem, so it has a journal and extents
61     * 4K block size, so we expect writes to be aligned
62     * located inside an LV, so more realistic
63
64 - guestfish-lv-ext4-4k-write-hello.qtr
65
66   $ guestfish -a test1.img -m /dev/VG/LV \
67       debug qtrace "/dev/vda on" : \
68       write /hello "hello, world." : \
69       debug qtrace "/dev/vda off"
70   where test1.img was created by the previous command.