Question

I'm writing a simple EC2 snapshot script and need to determine if there is a way to know if a filesystem is frozen or not. As it currently stands, trying to do anything to a frozen filesystem hangs the script (and hangs in bash shell as well).

Is there a command or way to know if the filesystem is in a frozen state?

Thanks!

Was it helpful?

Solution

Try to remount the filesystem:

mount -o remount /moint/point

If the filesystem is mounted using non-default options then make sure to specify the same options in the remount. This ensures that the remount will actually be a no-op if it succeeds. For example, if the filesystem is mounted with the noatime option, then use this command instead:

mount -o remount,noatime /moint/point

If the filesystem is unfrozen, the remount will succeed. If the filesystem is frozen, it will fail with EBUSY.

This is not foolproof because technically the remount could fail with EBUSY for some other reason (other than the filesystem being frozen) but will probably do the trick in most cases.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top