brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: diskutil verifyVolume checks a Mac volume without repairing anything

macOS
~/tips/tip-macos-diskutil-verifyvolume

diskutil verifyVolume /Volumes/Backup

Check a volume's file system for errors from Terminal before you decide on a repair.

When an external drive acts strange, I want to know whether its file system is damaged before I let anything change it. Disk Utility’s First Aid repairs straight away; diskutil has a check-only option.

Point verifyVolume at a mounted volume, a disk identifier or a mount point:

diskutil verifyVolume /Volumes/Backup
diskutil verifyVolume disk4s1

The man page explains what happens: the right fsck program runs, the volume is left mounted or unmounted the way it was, and any storage layer underneath, such as the APFS container, is checked first. It also says a “live” verify, even of the boot volume, is supported in some cases, and that you need to own the disk you verify.

At the end it reports whether it found problems. If the volume is clean, the problem is probably the cable, the enclosure or the app, not the file system. diskutil list shows the identifiers if you’d rather use those.

When it does find damage, the repair counterpart is diskutil repairVolume, which does change the disk. I’d make sure I have a copy of anything important first, or let Disk Utility’s First Aid do it. And keep the difference with hdiutil verify in mind: the hdiutil man page explains that one checks the blocks of a disk image file, not the file system inside it.

Further reading: diskutil.8 man page, hdiutil.1 man page

More macOS tips System Settings > Accessibility > Hover Text > When using the pointer A Smart Folder in Notes collects notes by tag, checklist or date Type # in a Mac note to tag it, then filter by tag in the sidebar tmutil isexcluded ~/Projects/app/node_modules Crop an image in Preview by dragging a frame and clicking Crop All macOS tips (99) All topics

Link