Sorry if this question is asked already; but I could not find any such post.

I am currently working on an issue on inode reported by a customer.

Issue:
In customer system, we see the following error every time he reboots:

EXT4-fs error (device sda1): ext4_lookup: deleted inode referenced: 3855

After googling, I found about "fsck" and have made changes in the bootup code to fix this.

Question:
Before I give my build, I need to confirm if my fix is really working fine or not. So my question is that: how can I simulate this error so that I can try in our systems and verify if the fix is working or not?.

Details:

$> uname -a
Linux VCFC4CN8513000U 2.6.34.6 #1 SMP PREEMPT Tue Mar 29 01:56:25 PDT 2016 ppc GNU/Linux


$> mount
...
`/dev/sda1 on /mnt type ext4 (rw,noatime)`

sda1 is the partition in which I want to delete some inode references. Any pointers to simulate this inode deletion scenario?
I am thinking dd command should give me some clues; but I just cant get it right. I will update here if I get to recreate this scenario using this.

Thanks!

DO NOT DO THAT!!! Assuming that /dev/sda1 is the root file system, then the problem is more difficult. If it isn't, then as root you will need to umount that file system with "umount /dev/sda1", and then run "fsck /dev/sda1". If it is the root file system, then you need to boot a live CD/DVD, and as root, do the same thing, except the umount part since it won't be mounted automatically by the live CD/DVD. The fsck command will fix these inode problem. If it says that the file system is clean, then add the "-f" option to force it to scan/fix the file system anyway.

Looking further at your post, you show that /dev/sda1 is mounted on the /mnt directory. So this is what you do:

umount /mnt
fsck -f /dev/sda1
mount /dev/sda1 /mnt

If it mounts cleanly at the end, then you should be fine. You can also add the "-v" (verbose) option to get more information from fsck.

NEVER, NEVER, EVER try to manipulate directly the file system other than via normal means, unless you are a real professional and are ready to bork the system entirely!

I agree. Never bork with systems like that. And then, where's the backup copy if you borked it too hard?

Beginner: No backups.
Not beginner: Backup.
Pro: Backups.
Seasoned Pro: So many backups.
Burnt out Pro: No backups.

thanks @rubberman and @rproffitt.
Yes, I am doing fsck before I mount the partition.
I agree I should not mess with the filesystem directly; But fortunately I can mess with the system; and I don't have any data in it to backup.
And I know the backdoor to install fresh build if I bork it too hard.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.