GithubHelp home page GithubHelp logo

hfshealth's Introduction

Description

This utility verifies HFS file systems by using fsck_hfs command line interface inside. Verification will avoid the time machine backup process by waiting until backup will be done. Also, we will lock your disk volume from I/O operations while verification proceeds.

NOTE: This utility was designed for MacOS and works with bash shells only.

Notices

The shell script not maintained or supported by the developer. It was made for personal use only, so please don't use it on production or commercial platforms. There is no warranty in any cases.

This script was made for automating the volume structure verification, and notify an administrator about any problems was found for.
We will not try to fix any problems automatically, cause in some cases it will exacerbate the problem.

Installation

wget -O /usr/local/bin/hfshealth https://raw.githubusercontent.com/timoshka-lab/hfshealth/master/hfshealth.sh
chmod +x /usr/local/bin/hfshealth

Usage

Basic syntax

sudo hfshealth [OPTIONS] {Volume UUID}

Usage with options

Simply, verify the health of your volume and get results as stdout.

sudo hfshealth 7DFCEB10-F686-3834-A903-8E61D9CBAC03

Also, you can send verification results into your slack channel. For specific instructions about Slack webhooks API, please check this article.

sudo hfshealth --slack-url https://hooks.slack.com/services/XXXXXX/XXXXXX/XXXXXX 7DFCEB10-F686-3834-A903-8E61D9CBAC03

Working with cron scheduling

At first, you have to open the crontab settings as root user. Without root user privileges, fsck_hfs command won't work fine.

sudo crontab -e

Next, we have to include some path which we use inside the shell script.

PATH=/usr/bin:/bin:/usr/sbin:/sbin

# Run hfs verification every day at midnight
0 0 * * * /usr/local/bin/hfshealth --slack-url https://hooks.slack.com/services/XXXXXX/XXXXXX/XXXXXX 7DFCEB10-F686-3834-A903-8E61D9CBAC03

The way to find your volume UUID

You can find the UUID easily by using diskutil command. If you don't know you device identifier, you can find it by diskutil list command, which will list all disks on your system. The volume identifier will be looked like disk4s2.

diskutil info /dev/diskXXX | grep "Volume UUID"

Why UUID ?

fsck_hfs was designed to work with device identifier which can be changed by replacing your storage disk to another USB or Thunderlot device. So, it won't be safe to use the device identifier for scheduling verification jobs at background system.
My first purpose of this script was to make it work with the Volume UUID instead of identifier.

hfshealth's People

Contributors

timoshka-lab avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.