Jump to content
  • Announcements

    • spinynorman

      Mandriva Official Documentation

      Official documentation for extant versions of Mandriva can be found at doc.mandriva.com.   Documentation for the latest release may take some time to appear there. You can install all the manuals from the main repository if you have Mandriva installed - files are prefixed mandriva-doc.
    • paul

      Forum software upgrade   10/29/17

      So you may have noticed the forum software has upgraded !!!
      A few things that have changed. We no longer have community blogs (was never really used) We no longer have a portal page.
      We can discuss this, and decide whether it is needed (It costs money) See this thread: Here
Sign in to follow this  
ianw1974

tune2fs and inodes

Recommended Posts

Currently, in tune2fs - the tool for enabling journaling on ext2 partitions and various other stuff has a feature that should work, but it doesn't seem to - at least in my case.

 

Last night, I thought it would be a great idea to change my inode size from 128 to 256 on my /home partition. I didn't take a backup, because I thought since tune2fs could enable journaling OK, it should be able to modify inode sizes. So I did:

 

tune2fs -I /dev/sda3

 

being my /home partition. Now, this ran and ran and ran, for a few hours, and it was still going. I only have a 110GB partition so this shouldn't in theory have taken too long. Anyway, later on, either the CTRL-C I pressed cancelled it, or it simply finished as the response wasn't immediate. My system still have 128 inode value set, and figured that it had been trying to change it and hadn't actually done anything.

 

My system seemed fine, all my files were there, and I rebooted and everything was normal. That was until later today, whilst doing some heavy disk read/writes that my whole system hung. I had no keyboard response, and so issued the ALT-SYSRQ sequence to in as much as safe as possible restart my machine - ALT-SYSRQ RSEIUB - which it did fine.

 

The problem was, that /home wouldn't come online because of a problem, and I couldn't enter the password to go into maintenance mode - so I rebooted with a LiveCD. On checking the system, it said it had problems with inodes, and asked if I wanted to repair. So, I said yes to everything.

 

Then, after mounting /home to check all was OK, I noticed everything was gone! :o

 

To my shock, I thought I'd just lost over 80GB of data. I then downloaded a recovery CD, which in all honesty didn't do much as it would only recover partitions deleted from a disk - which can also get your data back. I had my partitions, I just didn't have the data.

 

I then mounted /home again, and checked in the Lost&Found folder and saw a load of folders with #nnnnnnn - where nnnnn was a number. On checking inside these, I could see all my data, so I just moved them back to their previous locations. Then, after doing:

 

tune2fs -j /dev/sda3

 

to enabling journaling and thus have ext3 again instead of just ext2, I could now boot my system normally, and I had all my data!

 

So, whilst I was lucky, don't do as I do. Get a backup first before trying something so stupid as changing your inode size - which, I should have realised before doing this that there was a likelihood of a major problem! Like, data-loss.

 

For the life of me, I cannot see why this option exists to change the inode. Either it's there for the future (ext4), or I should have left my system for a day or two for it to finish changing the inode size. Either way, I won't be doing it again. The most simplest way to change it is:

 

1. Copy off all data to another machine.

2. Format the partition and specify the inode size you want.

3. Copy data back to partition.

 

Well, it was a nice lesson, and the outcome wasn't as bad as it should have been :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×