Today's article explains how to repair your filesystem with a live USB/DVD.

KGIII

Super Moderator
Staff member
Gold Supporter
Credits
19,871
It's really rather basic and most folks here will already know how to do this and many will even be able to run fsck manually to get good results. Still, there are some who won't and some who will need to ask in the future.


Oddly, it's easier to write a more advanced article - or so it seems. It seems more difficult to think like a beginner.
 


captain-sensible

Well-Known Member
Credits
11,562
from memeory -y is just fix it ; last time i used it i also used -v flag . I think with y , it might seem with no output nothing is happening. But your right about the power outage ; at times i was running fsck four times a day sub-sahara .

Now you used fsck rather than for instance fsck.ext4 for ext4 file system i think that means , fsck will know what to do when it gets to the fat32 efi partition.


to see whats in the fsck locker run :

Code:
[[email protected]:~][1]$ ls /usr/sbin/fsck*                    (05-31 18:02)
/usr/sbin/fsck*         /usr/sbin/fsck.ext3*   /usr/sbin/[email protected]
/usr/sbin/fsck.btrfs*   /usr/sbin/fsck.ext4*   /usr/sbin/[email protected]
/usr/sbin/fsck.cramfs*  /usr/sbin/fsck.fat*    /usr/sbin/fsck.xfs*
/usr/sbin/fsck.ext2*    /usr/sbin/fsck.minix*
[[email protected]:~]$                                          (05-31 19:26)
 

KGIII

Super Moderator
Staff member
Gold Supporter
Credits
19,871
Yeah, the -y just fixes everything - or tries to. It's generally good enough and fsck is a front-end to other tools and works well enough when run by itself.

I figure anyone reading this article in earnest is going to be a beginner. Most everyone here will already know this - and might even benefit from running fsck (or other tools) manually.

Given where you live, I'd definitely want a UPS, or at least a laptop. The power is unlikely to be all that reliable.
 

Tolkem

Well-Known Member
Credits
6,474
from memeory -y is just fix it
Yeah, the -y just fixes everything
y = yes when you run fsck without y, it asks questions you should answer with y or n. By the way, BTRFS doesn't use fsck but btrfs-check, and though discourage and not recommended, unlike fsck it can be run while the system's running., that being said, your article should specify that fsck doesn't work with that file system.
 

captain-sensible

Well-Known Member
Credits
11,562
Yeah, the -y just fixes everything - or tries to. It's generally good enough and fsck is a front-end to other tools and works well enough when run by itself.
in bligh
I figure anyone reading this article in earnest is going to be a beginner. Most everyone here will already know this - and might even benefit from running fsck (or other tools) manually.

Given where you live, I'd definitely want a UPS, or at least a laptop. The power is unlikely to be all that reliable.
we are back blighty ooo
 

captain-sensible

Well-Known Member
Credits
11,562
y = yes when you run fsck without y, it asks questions you should answer with y or n. By the way, BTRFS doesn't use fsck but btrfs-check, and though discourage and not recommended, unlike fsck it can be run while the system's running., that being said, your article should specify that fsck doesn't work with that file system.
i've ran fsck on a running Slackware with no problems by dropping to run level 1
Code:
# telinit 1
// then umount root partition
and some how something was still running so i could use fsck - that might be a quirk of Slackware ?
 

Tolkem

Well-Known Member
Credits
6,474
i've ran fsck on a running Slackware with no problems by dropping to run level 1
Code:
# telinit 1
// then umount root partition
and some how something was still running so i could use fsck - that might be a quirk of Slackware ?
AFAIK, fsck can't be run while the system's running, because the /root partition's mounted, so it's not safe to run a check against a mounted system, you can run fsck to check/repair a non-mounted drive/partition/system/disk from a running system, i.e. a USB drive that uses a Linux file system.
 

captain-sensible

Well-Known Member
Credits
11,562
AFAIK, fsck can't be run while the system's running, because the /root partition's mounted, so it's not safe to run a check against a mounted system, you can run fsck to check/repair a non-mounted drive/partition/system/disk from a running system, i.e. a USB drive that uses a Linux file system.
i've done it and on a slackware forum :

The 'single' boot parameter that you pass to the inet process provides a means to instruct the init to boot the computer in a single user mode. The init does not launch all the usual daemons.

Therefore you can maintain the system in a fashion without the worry of other users on the system. As root you can then perform maintenance on the system without conflict(s). You can perform the 'fsck' without the worry of r/w to the filesystem you are going to be working on by another user.
 

KGIII

Super Moderator
Staff member
Gold Supporter
Credits
19,871
BTRFS doesn't use fsck but btrfs-check
Are you sure this is still true? It looks like it should be a front end for "fsck.btrfs".

It looks like that was once true, but now fsck works with BTRFS. (But...)

It looks like it does exist - but that you shouldn't ever really need to use it because BTRFS should mostly be self-healing.

I suppose I'm going to need to test this. BTRFS didn't even cross my mind as it was an article for beginners and they usually just use ext4.

Hmm... This might be interesting enough for an article all its own, though I think I'll need to do several more hours of reading and then testing.
 

Tolkem

Well-Known Member
Credits
6,474
Are you sure this is still true? It looks like it should be a front end for "fsck.btrfs".
btrfs check --repair (used to be called btrfsck) checks consistency of a btrfs filesystem, and optionally repair some types of breakage. It can only be run on an unmounted FS.
and https://www.suse.com/support/kb/doc/?id=000018769

i've done it and on a slackware forum :
Didn't know that.
 

KGIII

Super Moderator
Staff member
Gold Supporter
Credits
19,871
Right, I actually saw that link which suggests reading:


Which states that you mostly don't need it, while also saying "Run online fsck nightly or weekly, and look for errors that btrfs is noticing and reporting in syslog:"

Which confuses the heck out of me.

I'm gonna have to do some reading.
 

Tolkem

Well-Known Member
Credits
6,474
Which states that you mostly don't need it,
This is because, as you mentioned before, Btrfs has an "auto-healing" mechanism, so users aren't supposed to have the need and use it. I see those processes running in openSUSE.

EDIT: Just checked that blog, it's from 2014. Btrfs is a work in progress, so most of that info might be outdated, and as a matter of fact, kernel 5.12 brings new features and remove some others from btrfs.
Both openSUSE and Fedora recently updated from 5.11 to 5.12. The "you almost don't need it" refers to fsck, which by the time was btrfsck.
 
Last edited:

KGIII

Super Moderator
Staff member
Gold Supporter
Credits
19,871
Hmm... So, in one or two sentences (to add to the article)...

"If you're using Btrfs, you shouldn't need to run fsck. There are Btrfs-specific commands that you should learn."

Where 'Btrfs-specific commands' would be a good place to link an article about them.
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Members online


Top