Visualizing #3: write a file on an ext4 filesystem

See previous posts: 2, 1

The first command is just to prepare the virtual disk image. The trace was captured from the second command only:

$ guestfish \
      alloc test1.img 40M : \
      run : \
      part-disk /dev/vda mbr : \
      pvcreate /dev/vda : \
      vgcreate VG /dev/vda : \
      lvcreate LV VG 32 : \
      mkfs-b ext4 4096 /dev/VG/LV
$ guestfish -a test1.img -m /dev/VG/LV \
      debug qtrace "/dev/vda on" : \
      write /hello "hello, world." : \
      debug qtrace "/dev/vda off"

Click the image to see the visualization at full size:

The writes are aligned which is good, but there sure are a lot of them considering I’m just creating a 13 byte file. I’m inclined to think there is an error in my methodology somewhere.

Here is the actual trace, where each line is R(ead) or W(rite) followed by the first sector number and the number of sectors.

R 416 8
R 536 8
R 664 8
R 408 8
W 456 8
W 464 8
W 10712 8
W 472 40
W 512 8
W 392 8
W 408 16
W 536 8
W 664 8

Update Many thanks to Eric Sandeen who analyzed the trace above. His report is below (note Eric has adjusted the numbers to be 4K blocks relative to the start of the filesystem):

R  4 1  <- read block bitmap
R 19 1  <- read inode bitmap
R 35 1  <- read inode table
R  3 1  <- read block bitmap
W  9 1  <- journal write
W 10 1  <- journal write
W 1291 1 <- write the file data
W 11 5  <- journal write
W 16 1  <- journal write
W  1 1  <- superblock write
W  3 2  <- write block bitmap
W 19 1  <- write inode bitmap
W 35 1  <- write inode table
About these ads

Leave a comment

Filed under Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s