Using cvfsdb to delete an inode

 Using cvfsdb to delete an inode

 

Use with caution ! Incorrect use can lead to data loss other than the data you are attempting to delete. This operation cannot be undone.

 

The following instructions allow you to delete a file using cvfsdb in the event that other methods to delete the file fail. (EG, accessing a directory containing a corrupt inode fails/hangs/crashes). Normally the error messages leading to the need to delete the file in this way will indicate the inode. (See also my Qwikipedia article “Examining SNFS inodes and Directories”),

 

Determine or confirm the inode number of the file requiring deletion. In this example “testfile.0010” has inode 25 (0x19)  :

 

PCG-SNSM.labs# ls -li /stornext/filltest/testfile.0010

25 -rw-r--r-- 1 root root 2588672 Mar 13 13:02 /stornext/filltest/testfile.0010

 

To remove the inode we need to use cvfsdb to “poke” the inode with value “0” to invalidate it so that cvfsck deletes it. The poke command is of the form :

 

      poke <sg number> <block number> <offset> <value>

 

Use cvdsdb on the filesystem containing the file to display the inode information, confirm the filename and get the values we need for the poke (note that only relevant parts of the inode output are shown below) :

 

PCG-SNSM.labs# cvfsdb filltest

cvfsdb> show inode 25

ShowInode 0x19 (IelKey: 0x0, Sg: 0, Block: 0x1, ByteOffset: 9216)

...

  Extended attribute area =

000:  0101 6001 4004 0315 5250 4c00 0000 0000  |..`.@...RPL.....

010:  0000 0274 6573 7466 696c 652e 3030 3130  |...testfile.0010

020:  0000 0000 0000 0000 0000 0000 0000 0000  |................

...

 

For the file above this would be :

 

      poke 0 0x1 9216 0

 

IE :

 

cvfsdb> poke 0 0x1 9216 0

sg/0 block/0x1 offs/9216: 0x6d636269247d1217 => 0x0000000000000000

 

Unmount and stop the filesystem as necessary:

 

PCG-SNSM.labs# umount /stornext/filltest

PCG-SNSM.labs# cvadmin -e "stop filltest"

Select FSM "none"

 

 

Stop FSS "filltest"

 

FSS 'filltest' on PCG-SNSM stop initiated.

FSS 'filltest' stopped.

 

Use cvfsck to identify and remove the inode. Note that you should run “cvfsck –nv” on the filesystem first and make sure that only changes you are expecting will be made :

 

PCG-SNSM.labs# cvfsck -v filltest

...

Building Inode Index Database

*Error*: check_binode_basics: Corrupted inode 0x19 (Bad Marker(s)).index 25

*Error*: buildinodes: Corrupted IEL block/0x0 Index 25: Repaired.

...

Checking directories

Directory entry testfile.0010 (p=0x2 i=0x19 flags=0x21) is an orphan. Removed.

...

Verifying link & subdir counts

*Error*: Inode 0x2 link count is 105 - should be 104. Fixed.

...

Super Block -  Free Inodes of 0x4037 is wrong! Should be 0x4038.

...

Free inode count is wrong (was 0x4037 should be 0x4038)

...

 

Restart and mount the filesystem :

 

PCG-SNSM.labs# cvadmin -e "start filltest"

Select FSM "none"

 

 

Starting FSS locally.

Start FSS "filltest"

 

FSS 'filltest' start initiated.

FSS 'filltest' started.

 

PCG-SNSM.labs# mount /stornext/filltest

mount.cvfs: Filesystem filltest mounted on /stornext/filltest

 

Check that the intended file is now gone :

 

PCG-SNSM.labs# ls -li /stornext/filltest/testfile.0010

ls: cannot access /stornext/filltest/testfile.0010: No such file or directory



This page was generated by the BrainKeeper Enterprise Wiki, © 2018