In a write-back cache, when changes are made to cached data, they are not simultaneously made to the original data as well. Instead, the changed data is marked, and the original data is updated when the chached data is deallocated.
In a write-through cache, by contrast changes made to cached data are simultaneously made in the original copy. A write-back cache can perform more quickly than a write-through cache. But in some contexts, differences between cached and original data could lead to problems, and write-through caches must be used
source
Now, Its doesn't matter what OS are you working on the really thing that affects is the file system you are using.
Ubuntu by default use ext4 as it filesystem and to know ext4 uses the both modes write-back and write-through.
To enable write back mode
Run:
tune2fs -o journal_data_writeback /dev/sd*
Edit fstab
vi -w /mnt/sdXY/etc/fstab
Find the line that references sd* It will look something like:
# /dev/sda2
UUID=be2f0ac2-4683-4550-bcd1-704a1a840b3e / ext4 relatime,errors=remount-ro 0 1
The first entry is the UUID .
The second entry is the path.
Third is the fstype .
Fourth are the options.
Fifth is for dump
Sixth is pass.
Change the options(4th) to:
noatime,data=writeback,barrier=0,nobh,errors=remount-ro
Reboot your system to complete changes.
source
Also check this for more information.