How to perform full check of ext4 file system structure?
I have 2TB ext4 partition with half million files on it.
I want to check whether this partition contains any errors or not.
I don't want to search for bad blocks, only logical structure should be checked.
I have unmounted the partition and run fsck /dev/sda2
, but fsck returns immediately with exit code 0 without actually checking whole file system.
I'm expecting full partition check would take hours to complete.
I have read man fsck
but did not find an option for "thorough testing".
I'm afraid my partition may have some sectors accidentally overwritten by garbage data.
My HDD was previously connected to another OS, and ext4 partition may get harmed by wrong behavior of that OS.
That's why I want to be sure the whole tree structure is completely correct.
In other words, I want to perform a check similar to what utility chkdsk.exe
does on Windows.
What should I use on Debian to completely check ext4 file system?
debian partition fsck
add a comment |
I have 2TB ext4 partition with half million files on it.
I want to check whether this partition contains any errors or not.
I don't want to search for bad blocks, only logical structure should be checked.
I have unmounted the partition and run fsck /dev/sda2
, but fsck returns immediately with exit code 0 without actually checking whole file system.
I'm expecting full partition check would take hours to complete.
I have read man fsck
but did not find an option for "thorough testing".
I'm afraid my partition may have some sectors accidentally overwritten by garbage data.
My HDD was previously connected to another OS, and ext4 partition may get harmed by wrong behavior of that OS.
That's why I want to be sure the whole tree structure is completely correct.
In other words, I want to perform a check similar to what utility chkdsk.exe
does on Windows.
What should I use on Debian to completely check ext4 file system?
debian partition fsck
1
@SatoKatsura - Thanks! I just wonder whye2fsck -f
check is so fast - it takes only several seconds? It's amazing compared to Windows behavior (it takes hours).
– Egor Skriptunoff
Feb 24 '17 at 10:30
add a comment |
I have 2TB ext4 partition with half million files on it.
I want to check whether this partition contains any errors or not.
I don't want to search for bad blocks, only logical structure should be checked.
I have unmounted the partition and run fsck /dev/sda2
, but fsck returns immediately with exit code 0 without actually checking whole file system.
I'm expecting full partition check would take hours to complete.
I have read man fsck
but did not find an option for "thorough testing".
I'm afraid my partition may have some sectors accidentally overwritten by garbage data.
My HDD was previously connected to another OS, and ext4 partition may get harmed by wrong behavior of that OS.
That's why I want to be sure the whole tree structure is completely correct.
In other words, I want to perform a check similar to what utility chkdsk.exe
does on Windows.
What should I use on Debian to completely check ext4 file system?
debian partition fsck
I have 2TB ext4 partition with half million files on it.
I want to check whether this partition contains any errors or not.
I don't want to search for bad blocks, only logical structure should be checked.
I have unmounted the partition and run fsck /dev/sda2
, but fsck returns immediately with exit code 0 without actually checking whole file system.
I'm expecting full partition check would take hours to complete.
I have read man fsck
but did not find an option for "thorough testing".
I'm afraid my partition may have some sectors accidentally overwritten by garbage data.
My HDD was previously connected to another OS, and ext4 partition may get harmed by wrong behavior of that OS.
That's why I want to be sure the whole tree structure is completely correct.
In other words, I want to perform a check similar to what utility chkdsk.exe
does on Windows.
What should I use on Debian to completely check ext4 file system?
debian partition fsck
debian partition fsck
asked Feb 24 '17 at 9:49
Egor SkriptunoffEgor Skriptunoff
1611318
1611318
1
@SatoKatsura - Thanks! I just wonder whye2fsck -f
check is so fast - it takes only several seconds? It's amazing compared to Windows behavior (it takes hours).
– Egor Skriptunoff
Feb 24 '17 at 10:30
add a comment |
1
@SatoKatsura - Thanks! I just wonder whye2fsck -f
check is so fast - it takes only several seconds? It's amazing compared to Windows behavior (it takes hours).
– Egor Skriptunoff
Feb 24 '17 at 10:30
1
1
@SatoKatsura - Thanks! I just wonder why
e2fsck -f
check is so fast - it takes only several seconds? It's amazing compared to Windows behavior (it takes hours).– Egor Skriptunoff
Feb 24 '17 at 10:30
@SatoKatsura - Thanks! I just wonder why
e2fsck -f
check is so fast - it takes only several seconds? It's amazing compared to Windows behavior (it takes hours).– Egor Skriptunoff
Feb 24 '17 at 10:30
add a comment |
3 Answers
3
active
oldest
votes
As mentioned by Satō Katsura, run e2fsck
in "force" mode:
e2fsck -f /dev/sda2
This will force a check even if the system thinks the file system is clean. The "verbose" option is helpful too:
e2fsck -vf /dev/sda2
As a side-note, and not applicable in your case, but if you use LVM for your storage you can use the neat little lvcheck
tool to run an "offline" file system check on a mounted file system (it uses an LVM snapshot and updates the file system metadata if the check doesn't find any errors).
add a comment |
Also, you could add the -y
flag to avoid answering questions.
From the manual:
-y
assume an answer ofyes
to all questions; allowse2fsck
to be used non-interactively.
So extending the answer (since I cannot comment yet) from @Sato - you could run:
e2fsck -vfy /dev/sda2
5
That can be risky though, because you don't know in advance what you may get asked, and forcing a yes answer to everything could in the worst case lead to loss of otherwise recoverable data.
– Alex
Feb 24 '17 at 13:10
add a comment |
You can also check live file systems in read-only mode with this:
e2fsck -vfn /dev/sda2
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f347280%2fhow-to-perform-full-check-of-ext4-file-system-structure%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
As mentioned by Satō Katsura, run e2fsck
in "force" mode:
e2fsck -f /dev/sda2
This will force a check even if the system thinks the file system is clean. The "verbose" option is helpful too:
e2fsck -vf /dev/sda2
As a side-note, and not applicable in your case, but if you use LVM for your storage you can use the neat little lvcheck
tool to run an "offline" file system check on a mounted file system (it uses an LVM snapshot and updates the file system metadata if the check doesn't find any errors).
add a comment |
As mentioned by Satō Katsura, run e2fsck
in "force" mode:
e2fsck -f /dev/sda2
This will force a check even if the system thinks the file system is clean. The "verbose" option is helpful too:
e2fsck -vf /dev/sda2
As a side-note, and not applicable in your case, but if you use LVM for your storage you can use the neat little lvcheck
tool to run an "offline" file system check on a mounted file system (it uses an LVM snapshot and updates the file system metadata if the check doesn't find any errors).
add a comment |
As mentioned by Satō Katsura, run e2fsck
in "force" mode:
e2fsck -f /dev/sda2
This will force a check even if the system thinks the file system is clean. The "verbose" option is helpful too:
e2fsck -vf /dev/sda2
As a side-note, and not applicable in your case, but if you use LVM for your storage you can use the neat little lvcheck
tool to run an "offline" file system check on a mounted file system (it uses an LVM snapshot and updates the file system metadata if the check doesn't find any errors).
As mentioned by Satō Katsura, run e2fsck
in "force" mode:
e2fsck -f /dev/sda2
This will force a check even if the system thinks the file system is clean. The "verbose" option is helpful too:
e2fsck -vf /dev/sda2
As a side-note, and not applicable in your case, but if you use LVM for your storage you can use the neat little lvcheck
tool to run an "offline" file system check on a mounted file system (it uses an LVM snapshot and updates the file system metadata if the check doesn't find any errors).
edited Oct 4 '18 at 9:44
answered Feb 24 '17 at 9:55
Stephen KittStephen Kitt
174k24399475
174k24399475
add a comment |
add a comment |
Also, you could add the -y
flag to avoid answering questions.
From the manual:
-y
assume an answer ofyes
to all questions; allowse2fsck
to be used non-interactively.
So extending the answer (since I cannot comment yet) from @Sato - you could run:
e2fsck -vfy /dev/sda2
5
That can be risky though, because you don't know in advance what you may get asked, and forcing a yes answer to everything could in the worst case lead to loss of otherwise recoverable data.
– Alex
Feb 24 '17 at 13:10
add a comment |
Also, you could add the -y
flag to avoid answering questions.
From the manual:
-y
assume an answer ofyes
to all questions; allowse2fsck
to be used non-interactively.
So extending the answer (since I cannot comment yet) from @Sato - you could run:
e2fsck -vfy /dev/sda2
5
That can be risky though, because you don't know in advance what you may get asked, and forcing a yes answer to everything could in the worst case lead to loss of otherwise recoverable data.
– Alex
Feb 24 '17 at 13:10
add a comment |
Also, you could add the -y
flag to avoid answering questions.
From the manual:
-y
assume an answer ofyes
to all questions; allowse2fsck
to be used non-interactively.
So extending the answer (since I cannot comment yet) from @Sato - you could run:
e2fsck -vfy /dev/sda2
Also, you could add the -y
flag to avoid answering questions.
From the manual:
-y
assume an answer ofyes
to all questions; allowse2fsck
to be used non-interactively.
So extending the answer (since I cannot comment yet) from @Sato - you could run:
e2fsck -vfy /dev/sda2
edited Feb 24 '17 at 11:22
GAD3R
26.9k1757112
26.9k1757112
answered Feb 24 '17 at 10:13
impalleimpalle
964
964
5
That can be risky though, because you don't know in advance what you may get asked, and forcing a yes answer to everything could in the worst case lead to loss of otherwise recoverable data.
– Alex
Feb 24 '17 at 13:10
add a comment |
5
That can be risky though, because you don't know in advance what you may get asked, and forcing a yes answer to everything could in the worst case lead to loss of otherwise recoverable data.
– Alex
Feb 24 '17 at 13:10
5
5
That can be risky though, because you don't know in advance what you may get asked, and forcing a yes answer to everything could in the worst case lead to loss of otherwise recoverable data.
– Alex
Feb 24 '17 at 13:10
That can be risky though, because you don't know in advance what you may get asked, and forcing a yes answer to everything could in the worst case lead to loss of otherwise recoverable data.
– Alex
Feb 24 '17 at 13:10
add a comment |
You can also check live file systems in read-only mode with this:
e2fsck -vfn /dev/sda2
add a comment |
You can also check live file systems in read-only mode with this:
e2fsck -vfn /dev/sda2
add a comment |
You can also check live file systems in read-only mode with this:
e2fsck -vfn /dev/sda2
You can also check live file systems in read-only mode with this:
e2fsck -vfn /dev/sda2
answered Feb 17 at 17:27
AttilaAttila
1
1
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f347280%2fhow-to-perform-full-check-of-ext4-file-system-structure%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
@SatoKatsura - Thanks! I just wonder why
e2fsck -f
check is so fast - it takes only several seconds? It's amazing compared to Windows behavior (it takes hours).– Egor Skriptunoff
Feb 24 '17 at 10:30