I'm trying to do a fsck on my primary partition with "sudo fsck /dev/sda1". It gives me the error:
Code: Select all
/dev/sda1 is mounted.
e2fsck: Cannot continue, aborting.
Thanks!
Code: Select all
/dev/sda1 is mounted.
e2fsck: Cannot continue, aborting.
Why?banderas20 wrote:I'm trying to do a fsck on my primary partition
sysytemd is not doing this for me, I have been using fsck.mode=force kernel param occasionally to get it to actually fsck all fs. I have played with passno in fstab, and have tried with and without the periodic interval/maxcount settings.Head_on_a_Stick wrote: It's actually quite difficult to stop systemd from doing that automatically on every boot
Code: Select all
# man systemd-fsck@.service
# mount | grep " / "
/dev/sda5 on / type ext4 (rw,noatime,discard,errors=remount-ro,commit=360,data=ordered)
# tune2fs -l /dev/sda5 | grep -A 5 "nt t"
Last mount time: Thu Jul 19 14:32:45 2018
Last write time: Thu Jul 19 14:32:45 2018
Mount count: 14
Maximum mount count: -1
Last checked: Mon Jun 18 06:41:08 2018
Check interval: 0 (<none>)
#
Yes, sorry: fs_passno should be set to a non-zero value in /etc/fstab otherwise the device will not be checked, thanks for the correction.bw123 wrote:sysytemd is not doing this for me
Because it's the only partition I have. The other is swap. ¿Can't I schedule to do it upon next boot, like windows says sometimes?Head_on_a_Stick wrote:Why?banderas20 wrote:I'm trying to do a fsck on my primary partition
Why cant you use live cd, what was already suggested? I always have a live-cd burned, for example situations like this.banderas20 wrote:Because it's the only partition I have. The other is swap. ¿Can't I schedule to do it upon next boot, like windows says sometimes?Head_on_a_Stick wrote:Why?banderas20 wrote:I'm trying to do a fsck on my primary partition
Thanks!
Code: Select all
$ systemctl status systemd-fsck-root.service
● systemd-fsck-root.service - File System Check on Root Device
Loaded: loaded (/lib/systemd/system/systemd-fsck-root.service; static; vendor
Active: inactive (dead)
Condition: start condition failed at Thu 2018-07-19 14:32:48 EDT; 2 days ago
└─ ConditionPathExists=!/run/initramfs/fsck-root was not met
Docs: man:systemd-fsck-root.service(8)
Yes. I know I can use it. I was just asking if there was another way to do it. For curiosity.arzgi wrote: Why cant you use live cd, what was already suggested? I always have a live-cd burned, for example situations like this.
You can try setting fs_passno to a non-zero value, this should start a check if it is needed (according to the rather cryptic man page) but bw123's experience seems to suggest that the fsck.mode=force kernel parameter may be needed.banderas20 wrote:if there was another way to do it
Code: Select all
# touch /forcefsck
# shutdown -r now
If the case if solved, please edit the first post of this thread, and add [SOLVED] to front of header.banderas20 wrote:Thank you all!
I have done so, and the file now is missing. However, I haven't seen anything that indicates fsck has been performed. ¿How can I see the results?kingocounty wrote:This might not be what you're asking, but you can force a file system check on reboot by dropping a blank file called 'forcefsck' in your root folder:
The file will be automagically removed after the fsck is performed.Code: Select all
# touch /forcefsck # shutdown -r now
Code: Select all
Last checked: Mon Jun 18 20:22:43 2018
Code: Select all
me@my-pc:~$ cat /run/initramfs/fsck.log
Log of fsck -C -a -T -t ext4 /dev/sda1
Mon Jul 23 13:07:06 2018
/dev/sda1: clean, 180885/15114240 files, 5754337/60449792 blocks
Mon Jul 23 13:07:06 2018
----------------
Code: Select all
me@my-pc:~$ cat /run/initramfs/fsck.log
Log of fsck -C -a -T -t ext4 /dev/sda1
Mon Jul 23 16:03:46 2018
/dev/sda1: clean, 182986/1245184 files, 1559599/4980480 blocks
Mon Jul 23 16:03:46 2018
Code: Select all
/* Print the summary message when we're skipping a full check */
log_out(ctx, _("%s: clean, %u/%u files, %llu/%llu blocks"),
Code: Select all
man systemd-fsck
Code: Select all
/dev/sda1: clean, 182986/1245184 files, 1559599/4980480 blocks
Edit your grub kernel line on boot and add in both of these kernel parameters for that boot. I haven't had to force a fsck since this sytemd crap came out, and very rarely before that ( so not SysV fault or something systemd "fixed"), so take it with a grain of salt.systemd-fsck understands one kernel command line parameter:
fsck.mode=
One of “auto”, “force”, “skip”. Controls the mode of operation. The default is “auto”, and ensures that file system checks are done when the file system checker deems them necessary. “force” unconditionally results in full file system checks. “skip” skips any file system checks.
fsck.repair=
One of “preen”, “yes”, “no”. Controls the mode of operation. The default is ” preen”, and will automatically repair problems that can be safely fixed. “yes ” will answer yes to all questions by fsck and “no” will answer no to all questions.