Please note that LinuxExchange will be shutting down on December 31st, 2016. Visit this thread for additional information and to provide feedback.

MY UBUNTU PC HAS THE FREE INODES I WANT TO USE ALL OF THEM WITH A AUTOMATIC SHELL SCRIPT. HERE ONE THING I DON'T WANT TO CREATE ANY FILE THAT MEANS WITHOUT CREATING ANY FILE I HAVE TO USE ALL FREE INODES IS THERE ANY COMMAND ? OR SCRIPT?

asked 24 Oct '14, 10:36

ashokkrishna's gravatar image

ashokkrishna
1112
accept rate: 0%

Inodes are generated when a filesystem is created. I don't understand your question - what do you mean by 'I want to use all of them ...' If you do this your file system will become unusable. What are you actually trying to accomplish? If you wish to free up extra inodes, the filesystem must be backed up and then recreated again with less inodes. See mkfs command for this.

(03 Nov '14, 21:37) stevendupuis

no i want to actually hack the things so iam searching is there any way to use all inodes to hack my friend

(15 Nov '14, 10:27) ashokkrishna

cause he challenged me without creating files

(15 Nov '14, 10:33) ashokkrishna



So you want to search directly from the inodes - the only way I can think of is 1) search the internet for software already written, if it exists, or 2) go thru the development docs about processing the file system and write your own code. The major scripting languages have system calls to do low-level hacking. There isn't anything that comes to mind from the linux utilities. There are thousands to research and its not me who wants to do this ...

Have you found anything yet?

Regards, Steve

link

answered 15 Nov '14, 11:13

stevendupuis's gravatar image

stevendupuis
1
accept rate: 0%

Hi,

Create Hard links, so in this way you will utilize all your inodes without breaching the limiting condition stated by your friend. When you create a hard link, it just created a new name in the table, along with the inode, without moving the file

Disclaimer : All the suggestions given over here to resolve the issue or to help the person who has asked questioned. If system behaves abnormally or become dead or questioner lost any data I will not be responsible for it.

Regards, LINUXKIDA

link

answered 17 Nov '14, 08:54

LINUXKIDA's gravatar image

LINUXKIDA
111
accept rate: 0%

Hi,

Create Hard link, so in this way you will utilize all your inodes without breaching the limiting condition stated by your friend. When you create a hard link, it just created a new name in the table, along with the inode, without moving the file

Disclaimer : All the suggestions given over here to resolve the issue or to help the person who has asked questioned. If system behaves abnormally or become dead or questioner lost any data I will not be responsible for it.

Regards, LINUXKIDA

link

answered 17 Nov '14, 08:54

LINUXKIDA's gravatar image

LINUXKIDA
111
accept rate: 0%

You can't do it by creating hard links - that doesn't use an inode.

A hard link is a file name that is associated with a pre-existing file the inode.

Now what you want can be done - sort of.

It will take a bit C code to do it right. The procedure is to do the following:

  1. create a file (easy enough, just do an open/create) and will allocate an inode.
  2. unlink the file (this removes it from the directory, and the file will be deleted when the program exits... This step isn't necessary IF you use the "open" with a flags value of O_TMPFILE. A directory path for the name is needed though ("/tmp" if that is the filesystem you are going to attack).
  3. repeat for 1021 times. Note: this allocates 1021 inodes (why 1021? because there is a default files open for stdin/stdout/stderr)
  4. don't exit... (either a very long sleep or suspend yourself- see the manpage on signal) One way to try this is fork, and exec the program again, then wait for child to exit.

step 4 is also a fork bomb. It will keep creating new processes until it fails... and then it cleans up for itself (you could then wait for terminal input on stdin though...)

Now this doesn't exhaust the inode list - you can check the actual limits with "ulimit -n". But what you can THEN do is run the program in the background... Up to the process limits ("ulimit -u"). In my case, the number of files is limited to 1024, and the number of processes is limited to 4096. That means the total number of files that can be created this way would be 4096*1024 or 4,194,304 inodes.

This may not use up ALL the inodes (depends on previous usage). The total number of inodes that you could allocate this way can be checked using "df -i". This will list the number of inodes that you can use - so pick the filesystem with fewest number available that you can use. (this is likely to be /tmp).

On my system /home is a 300GB disk with ext4 used for the filesystem. There are a total of 30,531,584 inodes, with 29,773,826 free - so I can't use up all the inodes this way even if I wanted to. /tmp on the other hand has only 1,021,909 inodes...

WARNING - don't do this on a filesystem using xfs. You can't exhaust the inodes because xfs will just allocate another disk block for inodes.

link

answered 03 Mar '15, 18:36

Jesse%20Pollard's gravatar image

Jesse Pollard
111
accept rate: 0%

Thanks Jesse for correcting me. I appreciate.

Regards, LINUXKIDA

link

answered 05 Mar '15, 08:13

LINUXKIDA's gravatar image

LINUXKIDA
111
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×90
×26
×16
×15
×8

Asked: 24 Oct '14, 10:36

Seen: 7,854 times

Last updated: 05 Mar '15, 08:13

powered by OSQA