General :: Remove A File On System Using Inode Number?
May 19, 2010
If you create a file on UNIX/linux with special chars, like touch "la*, you can't remove it with rm "la*. You have to use the inode number(you can if you add the before the name, I know, but you'd have to guess as a user that it was used in the file creation).
I checked the manpage for rm, but there's no metion of the inode number. Doing rm inodenumber doesn't work either.
Can we find the inode of a particular file using its inode number?
The reason is i want to know how many blocks are occupied by specific file.
if we consider block size of 1K. if the file size is of 100 bytes. In such a case, when the file is stored on disk, the file will occupy 100 bytes or 1K (since we have choosen block size to be 1K) ?
I am getting this error every night at 4am (right about when the cron.daily runs). when it does this, it remounts the filesystem read only. In the AM I get yelled at by users. all it takes is an fsck to fix the problem, but it does it every night. I have tried to rebuild the journal by removing the has_journal flag, running an fsck, and then re-adding the journal... same problem.. and its always the same inode.
anyone know that the ntfs's file sytem struct? is there's a API or something other could let me get this number? Or there is actually no such number in windows like the number of inode in linux?
I'm thinking of a few ways to do this I'm curious how many better/equal ways there are to do the same task.in a file with format like: 20 text Gi0/2 some other junk I have it reformatted to look like this before going in a database: 0/2 20 text. But for whatever reason some of the new input text looks like this now: 20 text Gi1/0/2 some other junk
My script makes it look like this: 1/0/2 20 text. I want it to remove the leading number and slash if the input file is in the new format.
I'm working on a midrange NAS system basically running on Linux and I got to do some great testing today. The step-by-step lead me to using fsdb to corrupt the magic number on a file system in order to corrupt it / test the script that should fix it.
I am using Slackware 13 x86_4. I have it set so that when I close my lid, it suspends to RAM. When I open my lid, it asks for password, but after I enter it, it freezes. I force KDE down by Ctrl+Alt+Backspace then read the errors. It says:
Code:
xauth: error in locking authority file /home/ridwan/.Xauthority rm: cannot remove '/home/ridwan/.serverauth.3457': Read-only file system
When I try to startx again, it says
Code:
/usr/bin/startx: line 158: cannot create temp file for here document: Read-only file system /usr/bin/startx: line 174: cannot create temp file for here document: Read-only file system /usr/bin/startx: line 174: cannot create temp file for here document: Read-only file system
[code]...
It forces me to power off the laptop by holding down the power button. When I try ctrl+alt+delete, I get an error saying "can't execute from /sbin/shutdown/"
I decided to take an old Gateway that I bought off a guy cheaply and turn it into a file and web server.I purchased copies of Debian 5.0.4 i386 disks (31 in all) on the advice of a friend, the disks weren't expensive, but now that Ive installed all the disks, I'm having a variety of errors
[443.110940 end request: I/O error, dev hde, sector 76021855 [443.111074] EXT3-fs error (device hde1): ext3_get_inode_loc: unable to read inode block - inode=2375715, block=9502724 INIT: cannot execute "/sbin/getty"
algorithm:breada input: file system block number for immediate read file system block number for asynchronous read output:buffer containing data for immediate read { if(first block not in cache) { get buffer for first block if(buffer data not valid) initiate disk read } if(second block not in cache) { get buffer for second block) if(buffer data valid) //line 1 release buffer else initiate disk read //line 2 } if(first block was originally in cache) //line 3 { read first block return buffer } sleep (event first buffer contains valid data) return buffer }
Here is an algorithm for block read algorithm. I have problem in line 1: If buffer data is valid why is it releasing the buffer? line 2: If buffer data valid why is it initiating disk read. It should have read directly from buffer? line 3: It should be the first condition as if it is there in cache then it should return it without delay?
I have tried burning a number of ISO's of 101.10 and 11.04 to DVD and intalling them on 2 of my desktop machines. I eventually see: ('initramfs) Unable to find a medium containing a live file system' The thought just occurred to me as I type this, perhaps I can only install from a CD and not a DVD?
Does anyone know how to get the path with a inode number by C programming? Or can I get the absolute path without giving a "path" but a inode number by C?
like this: get_path(unsigned inode); not such this function: getcwd(".", xxx); taowuwen@gmail.com
I'm looking for a way to insert the number of lines in a file to the start of the aformentioned file. This should be simple but as I am not used to scripts in Linux, I am finding it tough going. I can find the number of lines in a file easily enough via
filesize=$(awk 'END {print NR}' $1)
but as for inserting this into the first line, i'm failing to do so. I've tried some of the other approaches on these forums but none so far have been able to do so.
I've tried:
sed '1i$filesize' $1
but sed i requires a string, not a variable so no go I've also tried:
but again with no luck as cat seems to need an input stream Just to recap, i want to insert a line at the start of a given file that holds the number of lines the original file has.
I was wondering if it was possible to display inodes of deleted files using a command. If yes, is it possible to recover the deleted files from their inodes?
I was using gparted from a live usb to resize an ext4 partition and it failed while running resize2fs. The error it gave was
Code: resize2fs: The inode is from a bad block in the inode table while trying to resize /dev/sda5 please run 'e2fsck -fy /dev/sda5' to fix the filesystem after the aborted resize operation.
What is the user account number when you create a root user account for the system during the installation of any linux distribution? I'm not sure if its 0, 1, 10, or 100..
I'M working my way through Trainsignal's CompTIA Linux + Training course and I have a question about IRQs. According to the lesson using the command "cat /proc/interrupts", I need to memorize the system IRQs number columns 0-15. But when I use this command, I get somewhat of an unordered list, see below.
Anyone, I would like to ask if it was possible to change the entries of a file's inode table ?
For example
Code...
I was wondering if I can change the entries in this inode table's entries. For example I want to change the "Modify" entry ? I want it to reflect to day 2009-05-19 for example.
I need to get the max number from the name of a file
Formant of the file name: [a-zA-Z]*_[0-9][0-9]_[A-Z][A-Z].log Delimiter as underscore '_'
[code]....
known part in the above file name will be GA.log A give directory may or may not contain files in the above format or may contain file other then the above format if so then ignore it.
cmd=> ls *[0-9][0-9]_GA.log 2> /dev/null | awk -F_ '{ print $2}' | sort -nr | head -n1 | awk 'BEGIN { if ($1 >0 ) x=0; else x=1 } END {printf "%02.0f ", $1+1}'
output=> 01
if there are no files the output should be 01 and if file(s) found the output should be next highest number+1, In the above example it is 06 My cmd is bit lenghty. reduce my cmd and it should be in one line.
I'm currently trying to design a small, simple enough shell program for area codes. I have a list of area codes in a database, and I am trying to write a program that will have a user input an area code, and then have the program print out information that immediately follows that area code in my database. I assume I need to use a find or locate command, but I'm not sure if I should be searching for a string or the number itself. The number could possibly occur at some other point in the file, though the way I have the file set up it only occurs once at the newline.
what function I should use and how I should go about it? As is I only have the absolute bare-bones beginning of having an echo for the prompt to input an area-code, and the read once it's input. Without the find I'm not sure how much farther I can get. Also, would it make it easier if I added some character such as a ! to the end of the number at the newline to make it easier to search for? With a macro that would be easy enough to do.
I am using F14 Xfce and i have installed awn so i do not need my desktop icons anymore, ie home,bin and file system, is there any way to delete/remove them? i have installed gconf-editor and unchecked them in apps-->nautilus-->desktop, but they are still there?