const char *e2fsck = "/usr/sbin/e2fsck";
const char *f2fsck = "/usr/sbin/fsck.f2fs";
const char *dosfsck = "/usr/sbin/dosfsck";
+ const char *btrfsck = "/usr/bin/btrfsck";
const char *ckfs;
/* UBIFS does not need stuff like fsck */
ckfs = f2fsck;
} else if (!strncmp(pr->type, "ext", 3)) {
ckfs = e2fsck;
+ } else if (!strncmp(pr->type, "btrfs", 5)) {
+ ckfs = btrfsck;
} else {
ULOG_ERR("check_filesystem: %s is not supported\n", pr->type);
return;
if(!strncmp(pr->type, "f2fs", 4)) {
execl(ckfs, ckfs, "-f", pr->dev, NULL);
exit(-1);
+ } else if(!strncmp(pr->type, "btrfs", 5)) {
+ execl(ckfs, ckfs, "--repair", pr->dev, NULL);
+ exit(-1);
} else {
execl(ckfs, ckfs, "-p", pr->dev, NULL);
exit(-1);
if (pr) {
if (strncmp(pr->type, "ext", 3) &&
strncmp(pr->type, "f2fs", 4) &&
+ strncmp(pr->type, "btrfs", 5) &&
strncmp(pr->type, "ubifs", 5)) {
- ULOG_ERR("extroot: unsupported filesystem %s, try ext4, f2fs or ubifs\n", pr->type);
+ ULOG_ERR("extroot: unsupported filesystem %s, try ext4, f2fs, btrfs or ubifs\n", pr->type);
return -1;
}