rnunes
rnunes

Reputation: 2835

Propagate dd changes to filesystem top layer

I have several different filesystems in .img files that are mounted and I want to access them in two ways: one being the usual graphical file explorer, adding and removing files and folders and changing their content using the normal applications, while the other is through the command line tool dd directly to the .img file.

Here's the script that I am running:

fallocate -l 32M fat32.img
mkfs -t vfat fat32.img
sudo mount -t vfat -w -o loop fat32.img /media/fat32

After this, changes using the file explorer are, eventually, propagated to the .img file content (but not instantaneously), but the opposite doesn't happend. How can I disable or flush caches in order to force this update (both ways)?

I use this command to perform the dd

dd of=fat32.img oflag=sync conv=notrunc,fsync seek=86660 bs=1 count=5

I'm not handling collisions between the changes made by the file explorer and dd right now.

Upvotes: 0

Views: 40

Answers (1)

Allen Luce
Allen Luce

Reputation: 8389

After you make a change, run sync.

Upvotes: 1

Related Questions