Help with ext2fsck!

Yesterday morning (2023-06-15, around 08 AM BRT, 11 AM UTC), there was a short power outage here. It couldn't had lasted more than, say, three seconds at most.

Before the shortage, I was logged in, using X.org with xfce4, Firefox with plenty of tabs open, which usually means lots of thrashing every now and then and, apart of these, the only other GUI program that was open at the time was a xfce4-terminal with two tabs, one of them as root (running ($ su -)

The output of gpart show follows
Code:
=>       40  500118112  ada0  GPT  (238G)
         40    1048576     1  efi  (512M)
    1048616  499069536     2  freebsd-ufs  (238G)

=>        63  1953525105  ada2  MBR  (932G)
          63           1        - free -  (512B)
          64   838860800     1  linux-data  (400G)
   838860864     2592704        - free -  (1.2G)
   841453568  1112070144     3  linux-data  (530G)
  1953523712        1456        - free -  (728K)

=>        40  1953525088  ada1  GPT  (932G)
          40    20971520     1  freebsd-swap  (10G)
    20971560  1932553568     2  freebsd-ufs  (922G)

=>        63  1953525104  da0  MBR  (932G)
          63  1953525104    1  linux-data  [active]  (932G)

=>        63  1953525104  diskid/DISK-NA4V31PZ  MBR  (932G)
          63  1953525104                     1  linux-data  [active]  (932G)

I have three ext4 partitions total, all of them with data. I used to mount all of them up until I figured out it'd be better to mount them in an as-needed basis. One of them, however, is frequently mounted and was so at the time of the outage.

After the outage I immediately powered on, booted to a single-user shell, remounted root read-only (# mount -o ro /dev/ada0p2 /), then ran # fsck twice, then # e2fsck -v -tt to (try and) fix possible errors in my ext4 partitions as well (twice as well, adding (passing -f the second time). Rebooted normally, then logged in with my user and started xfce4. Tested the programs I usually keep opened and using, and everything seemed fine... until I tried to mount the ext4 that was mounted at the time of the outage.

In that terminal tab I kept logged as root and its, "user root" home folder (/root/), left to mount ext4 filesystems with fuse, there's a script for each of them. Here's one example:
Code:
#!/bin/csh

fuse-ext2 -o allow_other,force,uid=1001,gid=1001,umask=022 /dev/ada2s1 /mnt/
The only changes between each script the device node to be mounted, and the mount point. It should be noted that I've been using them for a couple of mount now and they worked so far. Besides, I live in Brazil and outages are not (unfortunately) all that rare early the year, especially during the Summer (from around December, 2*th, to around March, 2*th). No power outages had, so far, ended in really hard consequences.

Now, the other scripts do still work. By afternoon, I' decided to call it a day (health issues), took my pills and, soon, fell asleep. When I woke, I used an Ubuntu Live USB to $ e2fsck -vvvv -f -p (not sure if more than a single "-v" actually increases verbosity, but can't do any harm --- I read e2fsck(8)). The test completed without issues. After that, I mounted the partition using Nautilus, opened a file with OpenOffice, but couldn't edit it. It seems not even Ubuntu Linux Live USB's e2fsck can mount it read-write...?



And, here we are. If e2fsck couldn't at least find errors, what the hell could be corrupted, so no can do editing files, but would --- presumably, since I could $ sudo, $ su -, $ su, or $ sudo su (and, mind me saying, those are not exactly the same, AFAIK)?

Some tests I'm running as I type:
Code:
root@logos:~ # fuse-ext2 /dev/ada2s3 /mnt/
Mounting /dev/ada2s3 Read-Only.
Use 'force' or 'rw+' options to enable Read-Write mode
root@logos:~ # fuse-ext2 /dev/ada2s1 /mnt/
Mounting /dev/ada2s1 Read-Only.
Use 'force' or 'rw+' options to enable Read-Write mode
root@logos:~ # ls /mnt/
ls: /mnt/: Input/output error
root@logos:~ # umount /mnt/
root@logos:~ # ls /mnt/
root@logos:~ #
What is Input/output error? Can't even read it as root, and this error message tells me nothing. Almost every file in /var/log/ was last changed at least 4h ago but four:
  • /var/log/daemon.log
  • /var/log/debug.log
  • /var/log/bsdisks.log
  • /var/log/cron
Only /var/log/bsdisks.log had something on the disks:
Code:
Jun 15 02:16:17 logos bsdisks[33069]: Finished FS probe on  "ada1p1"
Jun 15 02:16:17 logos bsdisks[33069]: "Registering /org/freedesktop/UDisks2/block_devices/ada1p1"
Jun 15 03:05:50 logos bsdisks[33069]: Finished GEOM probe on  "ada2"
Jun 15 03:05:50 logos bsdisks[33069]: Finished GEOM probe on  "ada2s1"
Jun 15 08:37:09 logos syslogd: last message repeated 1 times
Jun 15 08:37:09 logos bsdisks[33069]: Finished GEOM probe on  "ada2"
Jun 15 08:42:36 logos syslogd: last message repeated 1 times
Jun 15 08:42:36 logos bsdisks[33069]: Finished GEOM probe on  "ada2s3"
Jun 15 08:47:55 logos bsdisks[33069]: Finished GEOM probe on  "ada2s1"
Jun 15 08:47:55 logos bsdisks[33069]: Finished GEOM probe on  "ada2"
Other ext4 partitions are doing fine. That rules out stuff like a needed kernel module being unloaded. Just in case, # kldstat:
Code:
Id Refs Address                Size Name
 1   76 0xffffffff80200000  213caf8 kernel
 2    3 0xffffffff8233d000    8cc90 vboxdrv.ko
 3    1 0xffffffff828e5000     73b0 linprocfs.ko
 4    6 0xffffffff828ed000     be88 linux_common.ko
 5    1 0xffffffff828f9000    14b98 netlink.ko
 6    1 0xffffffff8290e000     3284 linsysfs.ko
 7    2 0xffffffff82912000     4240 vboxnetflt.ko
 8    2 0xffffffff82917000     aac8 netgraph.ko
 9    1 0xffffffff82922000     31c8 ng_ether.ko
10    1 0xffffffff82926000     55e0 vboxnetadp.ko
11    1 0xffffffff8292c000   107310 nvidia-modeset.ko
12    1 0xffffffff82c00000  1fcf9d0 nvidia.ko
13    2 0xffffffff82a34000    31a90 linux.ko
14    1 0xffffffff82a66000    12cd8 fusefs.ko
15    1 0xffffffff82a79000     3250 ichsmb.ko
16    1 0xffffffff82a7d000     2180 smbus.ko
17    1 0xffffffff82a80000     3340 uhid.ko
18    1 0xffffffff82a84000     4350 ums.ko
19    1 0xffffffff82a89000     3380 usbhid.ko
20    1 0xffffffff82a8d000     31f8 hidbus.ko
21    1 0xffffffff82a91000     3320 wmt.ko
22    1 0xffffffff82a95000    2dc90 linux64.ko
23    1 0xffffffff82ac3000     2260 pty.ko
24    1 0xffffffff82ac6000     3530 fdescfs.ko
25    1 0xffffffff82aca000     4700 nullfs.ko

Since dmesg -a didn't help too, I'm getting stuck.

Code:
# fuse-ext2 -o allow_other,force,uid=1001,gid=1001,umask=022 /dev/ada2s5 /mnt/
root@logos:~ # fuse-ext2 -o allow_other,force,uid=1001,gid=1001,umask=022 /dev/ada2s1 /mnt/
root@logos:~ # ls /mnt/
ls: /mnt/: Input/output error
root@logos:~ # umount /mnt/
root@logos:~ # fuse-ext2 -o allow_other,uid=1001,gid=1001,umask=022 /dev/ada2s1 /mnt/
Mounting /dev/ada2s1 Read-Only.
Use 'force' or 'rw+' options to enable Read-Write mode
root@logos:~ # ls /mnt/
ls: /mnt/: Input/output error
root@logos:~ # fuse-ext2 -o allow_root,uid=1001,gid=1001,umask=022 /dev/ada2s1 /mnt/
Mounting /dev/ada2s1 Read-Only.
Use 'force' or 'rw+' options to enable Read-Write mode
fuse: 'allow_other' and 'allow_root' options are mutually exclusive
root@logos:~ # ls /mnt/
ls: /mnt/: Input/output error
root@logos:~ # fuse-ext2 -o allow_root,umask=022 /dev/ada2s1 /mnt/
Mounting /dev/ada2s1 Read-Only.
Use 'force' or 'rw+' options to enable Read-Write mode
fuse: 'allow_other' and 'allow_root' options are mutually exclusive
root@logos:~ # fuse-ext2 -o allow_root /dev/ada2s1 /mnt/
Mounting /dev/ada2s1 Read-Only.
Use 'force' or 'rw+' options to enable Read-Write mode
fuse: 'allow_other' and 'allow_root' options are mutually exclusive
root@logos:~ # umount /mnt/



Anyway... hours later, I'm not any closer to find out why even logged as root I couldn't read an ext4 partition, even after # e2fsck -vvvv -p -f with Ubuntu Linux Live USB failed to so much as find any problems. Plus, even there I couldn't edit the file, but could read it. Here at FreeBSD, no luck so far so good.

Any comments are appreciated.
 
fter the outage I immediately powered on, booted to a single-user shell, remounted root read-only (# mount -o ro /dev/ada0p2 /), then ran # fsck twice
Why didn't you let FreeBSD automatically do this on its own ? At least when it comes to ada0p2.

I would not let FreeBSD/fuse touch (fsck) ext4 data I care about. It's not its native FS, I would let Linux decide what to do. Not sure what damage (if any) was already done to it but I would keep troubleshooting this on that Ubuntu live stick. When you mount the partition under Linux, what does syslog say about that? Is that partition mounted rw? Did you try to create any files on it?
 
- and nobody helped OP in the slightest.
I asked OP about the state of FS reported by Linux. I do apologize, my mind reading is rusty this year. Also all my magic balls are broken, used on customer requests over the years.

With all seriousness we need to know what was the state of the FS mounted under Linux. Those answers to questions will help us understand what is the state of the FS.
 
Actually, I think _martin's comment was very helpful. A: Never allow a non-native version of fsck to mess with a file system. That's because fsck is a dangerous and powerful tool, and you have to be very careful using it. B: Even allowing a non-native file system mounting a disk read-write is a questionable practice. C: The best way to recover is to use the native fsck, and see what happens.
 
Back
Top