Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
FREEDOM251

Freedom251 › Blog › bcache

How to Recover From a Linux Kernel Page-Cache Regression Without Losing Data

By Freedom251 Team · · 12 min read

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The safest recovery sequence is to stop new writes, preserve the affected storage, boot the last known-good kernel, and treat every cache layer as a possible home for the newest data. Do not begin with fsck on the original device and do not assume that a successful buffered write() means the bytes reached stable storage.

Make an image or snapshot when possible, test persistence with explicit synchronization and error checks, keep the suspect kernel available for evidence but out of production, and repair only a copy. A rollback can stop the regression; it cannot recreate data that was still in RAM or a dirty writeback cache when the system failed.

As an Amazon Associate I earn from qualifying purchases.

What a page-cache regression can and cannot tell you

Linux normally accepts a buffered write by copying data into the page cache and marking those pages dirty. Writeback happens later, under kernel and filesystem control. Therefore, an application that received success from write() knows only that the kernel accepted the bytes at that point; it does not, by itself, prove that the storage device has them in non-volatile media.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Applications that need a durability boundary use a file-synchronization call such as fsync(), fdatasync(), msync(), or sync_file_range(), and they must inspect the return value. The Linux kernel VFS documentation describes these calls as the normal way for buffered-I/O applications to ensure that data has made it to the backing store. A synchronization call can report a writeback error that an earlier buffered write() did not report.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

The page-cache infrastructure does not remember which file description dirtied every individual page. Consequently, the kernel cannot always identify the exact descriptor that caused a writeback failure. Its error cursor is advanced per open file description, so separate writers can observe the same recorded error. Treat a synchronization error as evidence about the underlying file or storage path, not as a problem that can be safely ignored because a previous write returned zero.

The exact faulty kernel release, filesystem, controller, mount options, and workload determine the bug and the final fix. The procedure below is a conservative recovery method that keeps those unknowns from turning into additional data loss.

First response: contain the blast radius

Stop writers before investigating

Stop the affected service, job scheduler, database, queue consumer, or virtual-machine workload. If a service cannot be stopped cleanly, isolate it from clients and prevent new writes before taking further action. Remounting a filesystem read-only can be appropriate, but only if the operation itself will not trigger a risky journal, cache, or shutdown sequence. Do not run cleanup jobs, delete logs, rotate evidence, or repeatedly reboot while you are still determining what was persisted.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Keep the original device and its cache devices together. A cache device may contain newer blocks than the backing device, so treating the origin disk as a complete copy can be wrong.

Record the running state

Write evidence to separate, known-good media if possible. Capture the kernel, boot arguments, filesystem and storage topology before changing anything:

uname -a
cat /proc/cmdline
cat /etc/os-release
findmnt -o TARGET,SOURCE,FSTYPE,OPTIONS
lsblk -o NAME,KNAME,TYPE,SIZE,FSTYPE,MOUNTPOINTS,UUID
ls -l /boot
sudo dmsetup ls --tree
sudo dmsetup status
sudo journalctl -k -b 0 --no-pager > kernel-journal.txt
sudo dmesg -T > dmesg.txt

Also record the distribution kernel package version, the selected boot entry, RAID and LVM membership, controller or hypervisor details, and whether bcache or a device-mapper cache is present. Save recent application logs and the timestamps of the first bad result. These details let you reproduce the workload on a clone and distinguish a page-cache problem from a device, controller, or filesystem failure.

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

Preserve the storage before repair

Prefer a snapshot or sector-level image

If the device is readable, create a storage snapshot or a sector-level image on separate media before running a repair utility. Quiesce applications first so the captured state is internally meaningful. Perform analysis and repair against the snapshot or image, keeping the original unchanged for another attempt or specialist recovery.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A snapshot is useful only if its semantics match your storage stack. A copy made above a dirty writeback cache may omit blocks that exist only on the cache device. Document which layer created the snapshot and whether all cache metadata and data devices were included.

If the device is failing

Uncorrectable I/O errors, repeated resets, unusual mechanical noise, or rapidly increasing error counts change the priority: image the device with a workflow designed for failing media and minimize reads from the original. Do not repeatedly run filesystem checks on a mechanically failing disk. If a complete image cannot be made, preserve the device state and obtain specialist recovery help rather than trading the remaining readable sectors for a speculative repair.

Do not confuse read-only access with a backup

A read-only mount prevents normal application writes through that mount, but it does not create a second copy and may still replay or inspect filesystem metadata according to the filesystem’s rules. A snapshot or image is the reversible boundary; a read-only mount is only an operating mode used after that boundary exists.

Test what actually reached persistent storage

Use an application-level durability boundary

After writers are quiesced, use the affected application’s supported flush or checkpoint operation. For a simple file test on a disposable file, open it, write the expected contents, call fsync() or the application equivalent, and check the return code. If the file is newly created or its directory entry changed, synchronize the containing directory when the application and filesystem require that additional step. Do not substitute a successful close() for fsync(); close does not provide the same documented durability guarantee.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Record synchronization failures and correlate them with kernel messages. An error may be reported at synchronization time even though the original buffered write appeared successful. Preserve the exact error number, timestamp, path, and open file description that received it.

Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord | 6.35mm Jack, Durable Design, Stage and Home Studio Use, Low Noise Shielded Electric Cord for Bass, Keyboard, Amp, Mixer
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by

Interpret the main synchronization calls

Operation What it is intended to establish Important qualification
fsync() Flushes file data and required metadata for the open file to the storage path and reports writeback errors. It cannot recover bytes that were never supplied to the kernel, and its result depends on every layer honoring flush or FUA requests.
fdatasync() Flushes file data and the metadata needed to retrieve it, with a narrower metadata scope than fsync(). Use the application’s documented choice; file creation, size changes, and directory updates may need separate handling.
msync() Synchronizes changes made through a memory mapping when called with the appropriate synchronization mode. A mapped writer still needs correct error handling and, where required, a filesystem-level durability step.
sync_file_range() Controls writeback of ranges for workloads that need staged I/O management. It is not a universal replacement for a final durability operation; follow the application and filesystem documentation.

The VFS error cursor is tied to an open file description rather than to the individual page dirtier. Multiple processes can therefore encounter the same recorded writeback error, while another descriptor may not be able to identify which earlier write caused it. Preserve all such errors instead of treating a later successful call as proof that an earlier failure did not matter.

Roll back to a known-good kernel

Boot the previous entry without deleting the suspect kernel

  1. Use the bootloader’s advanced or recovery menu and select the last kernel that predates the regression.
  2. If the normal system does not boot, start the distribution’s recovery environment and mount the affected filesystem without write access.
  3. Confirm the running version with uname -r before mounting production volumes or starting services.
  4. Leave the suspect kernel installed and record its package version, configuration, and command line. It may be needed to reproduce the failure and identify the eventual fix.

Use the known-good kernel first with a clone or test workload. Compare file visibility, application checkpoints, kernel logs, writeback errors, and device errors. Change one variable at a time: kernel version, boot parameters, cache mode, or mount option. Do not use a successful reboot as evidence that missing data has been restored; rollback changes execution, not the contents of RAM, a dirty cache, or a damaged filesystem.

When a rollback changes the storage stack

A distribution recovery environment may load different storage, RAID, encryption, or cache modules than the production kernel. Verify that all devices are assembled in the same order and that the same cache metadata is visible before comparing behavior. If the recovery environment cannot safely activate the stack, stop at imaging and obtain a matching environment rather than forcing an activation that could discard dirty state.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Handle bcache and device-mapper cache explicitly

Cache layers add another location where the newest copy of a block may reside. Determine the mode and dirty-block state before detaching, reconfiguring, or discarding anything. Capture status output as evidence and do not rely on a clean-looking filesystem mount to prove that the cache is clean.

Mode Where newer data may be Recovery implication
Writeback The cache device can contain dirty blocks newer than the origin device. Detaching, discarding, or losing the cache can remove the only copy of recent writes. The bcache documentation warns that unrecoverable dirty data can leave the filesystem unrecoverable.
Writethrough Completed writes are sent to the origin before completion, although cache metadata and hardware caches still matter. Preserve both devices and verify flush behavior; do not assume that writethrough eliminates every consistency risk.
Passthrough I/O bypasses the cache for normal operation. Device-mapper cache documentation requires the cache to be clean before switching to passthrough. If metadata needs checking or repair, use the documented userspace recovery tools first.

Inspect without making a state-changing decision

For device-mapper configurations, save the output of dmsetup status and the device-mapper table before changing targets. For bcache, inspect the exposed sysfs state and dirty-data indicators for every cache set, and preserve the cache device alongside the backing device. Exact paths and controls vary by kernel and distribution; use the installed documentation for the matching version.

Prefer the documented flush-and-clean procedure for the specific cache implementation. Do not force a detach merely to make the origin mountable. If the cache cannot be made clean or its metadata is inconsistent, image both devices and work from copies with the cache-aware recovery tools.

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.

Account for volatile hardware write-back caches

Even after the page cache has been synchronized, the storage path may include a drive, RAID controller, virtual-machine host, or other device with a volatile write-back cache. Such a device can acknowledge a write before the bytes reach non-volatile media. Linux uses explicit flushes and force-unit-access (FUA) requests for data-integrity operations such as fsync, sync, and unmount.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The guarantee is conditional: every layer must correctly advertise and honor those requests. If a controller, hypervisor, or drive lies about flush completion, treat acknowledged data as uncertain. Check controller policy, drive cache settings, and hypervisor storage configuration without changing them on the only copy. When the path cannot demonstrate reliable flush or FUA behavior, restore from a known-good backup or image rather than claiming that synchronization made the data safe.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Repair the filesystem only on a preserved copy

Choose the filesystem’s own offline tool

Use the check or repair utility specified by the filesystem project and distribution, preferably from offline or read-only recovery media. Filesystem tools are not interchangeable. For example, an ext-family filesystem uses an e2fsck-family tool, XFS uses xfs_repair, and Btrfs uses its own checking and rescue procedures; the correct options depend on the exact version and failure mode.

Start with a non-modifying or read-only assessment when the tool provides one, and save the complete output. A representative ext-family assessment might use e2fsck -fn /dev/DEVICE; an XFS assessment may use xfs_repair -n /dev/DEVICE. These are examples, not universal commands: substitute the actual device and consult the matching filesystem documentation before running anything that can alter metadata.

Keep an audit trail

  • Record the image or snapshot identifier, source device, hash or other integrity marker, and creation time.
  • Save the tool version, command line, environment, and full standard output and error output.
  • List every proposed metadata change before accepting it when the utility allows that choice.
  • After repair, create a new copy or snapshot rather than overwriting the preserved original.

If the tool reports unrecoverable metadata or data, stop. Repeated repair attempts against the original can destroy structures that a specialist could otherwise recover. Escalate with the preserved image, cache metadata, kernel logs, and filesystem-tool output.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Verify the repaired copy before reopening service

Mount the repaired copy read-only first. Verification must cover both filesystem structure and application meaning:

  • Compare file counts, sizes, permissions, timestamps, and hashes with the last known-good backup where one exists.
  • Check database consistency using the database’s own offline or read-only verification command; a mount that succeeds does not prove that transactions are complete.
  • Review journal replay results and kernel messages for new I/O, checksum, or writeback errors.
  • Validate application invariants such as queue sequence numbers, object references, index counts, and expected record totals.
  • Run the workload on a clone under the known-good kernel before allowing production writes.
  • Monitor writeback errors, device errors, RAID state, and cache dirty status during the test and after the production cutover.

Only after those checks pass should you make the repaired copy writable and re-enable services. Keep the preserved image until normal backups contain a verified, readable version of the recovered data.

Choose among recovery paths

When several paths are available, compare them on the facts that determine whether a newer block can still be preserved and whether the action can be undone.

Path Newest-data risk Reversibility Consistency and observability Use when
Immediate repair on the original Highest: page-cache, cache-device, and hardware-cache state may be discarded or rewritten. Lowest. Hardest to audit; repair can hide the original failure. Only when no preservation option exists and specialist guidance says the risk is justified.
Image or snapshot, then repair the copy Lowest practical risk if every cache device and metadata area is included. High; the original remains available. Best for recording tool changes and comparing results. Default choice for a readable device.
Boot known-good kernel on the original, read-only Still present; rollback does not retrieve bytes that never persisted. Moderate if no writes occur. Useful for observing whether the regression is kernel-dependent. Testing and evidence collection after containment or imaging.
Switch a cache to passthrough Unsafe if dirty blocks remain or metadata is inconsistent. Depends on cache state and tooling. Requires documented clean-state checks and cache-aware recovery tools. Only after the cache implementation reports a clean, coherent state.
Restore from a known-good backup Known data loss is limited to the interval since the backup, rather than being guessed from a damaged live copy. High if the original is preserved. Application consistency depends on the backup method and checkpoint. When flush/FUA behavior is untrustworthy or the image is incomplete.

Common mistakes and the safer response

“The write returned success, so the file is safe.”

Buffered success may mean only that the page cache accepted the bytes. Use the application’s synchronization operation, inspect its error, and correlate it with kernel logs before declaring the data durable.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

“A reboot will clear the regression.”

A reboot can remove dirty pages from RAM without persisting them and can replay or alter filesystem state. Freeze writers and preserve an image before rebooting; use a deliberate bootloader rollback rather than repeated trial boots.

“The origin disk is the newest copy.”

In bcache or device-mapper writeback mode, dirty blocks may exist only on the cache device. Preserve and inspect both devices, and never detach or discard a dirty cache as a first diagnostic step.

“I should run fsck immediately.”

A repair utility changes evidence and may make later recovery harder. Image or snapshot first, assess the copy with the filesystem-specific tool, and save every proposed and completed change.

“Passthrough is a harmless diagnostic switch.”

Device-mapper cache passthrough is intended only for a clean cache. Switching while dirty blocks or damaged metadata remain can expose stale origin data or lose the newest writes.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

“fsync guarantees safety on every storage system.”

Synchronization depends on the drive, controller, hypervisor, and cache layers honoring flush and FUA requests. If any layer falsely reports completion, acknowledged data remains uncertain and a verified backup is the reliable recovery source.

A compact recovery checklist

  1. Stop or isolate writers and avoid cleanup, log rotation, and unnecessary reboots.
  2. Record kernel, boot command line, filesystem, mounts, storage topology, cache mode, and recent logs.
  3. Image or snapshot the complete storage path, including cache devices and metadata, when feasible.
  4. Test application and filesystem synchronization on a controlled or disposable file and preserve all return codes and errors.
  5. Boot the last known-good kernel and verify it before starting services.
  6. Determine bcache or device-mapper mode and dirty state; do not detach a dirty cache.
  7. Confirm whether the hardware path honors flush and FUA; treat lies as possible data loss.
  8. Run the filesystem’s offline check or repair tool on the preserved copy, not the original.
  9. Mount the repaired copy read-only and perform file, database, journal, and application-level checks.
  10. Exercise the workload on a clone, monitor errors, then reopen production only after verification.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

bcacheData Recoverydevice mapperfilesystem repairfsynckernelLinuxpage cache

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.