On Fri, Apr 27, 2007 at 12:33:26AM +0100 or so it is rumoured hereabouts,
Robert Sweetnam thought:
> Walter Faleiro wrote:
> > Hi,
> > I have a disk partition on which the inodes get totally used up. There is
> > around 50% of the disk space free, but no more files can be created.
> > If a few files are deleted, then the new files can be created.
> >
> > Is there any way to increase the number of inodes a disk partition can use,
> > after its been formatted?
> <From BSD mail list>
> Yes. Delete some files.
>> Then, when you have it cleared up temporarily (deleting files is
> only a brief temporary fix), back the file system up somewhere and
> remake it. In the newfs command, use bytes, block-size and frag-size
> arguments to force it to create more inodes in the filesystem and
> then restore the backup. Possibly just setting bytes=2 will be
> enough to cover it, but you may also need to set block-size=8192
> and frag-size=1024 (which is kind of small).
>> If you run out of inodes, it tends to mean you are creating a lot
> of small files. This can happen with some utilities that create
> a new file for each piece of data.
When this issue arose for us, we tar'ed up a bunch of the older files that
would only occasionally be needed. That freed up a bunch of inodes. We
didn't bother remaking the filesystem as we were migrating to a new
machine fairly soon.
If for some reason you cannot go the remake the filesystem route and you
cannot tar the files, there is another possibility:
make a block device in some of the spare space on the filesystem.
make a filesystem in the block device (with suitable block sizes)
mount that on a temporary mount point.
move a bunch of files (with a common directory root) into that filesystem.
loop mount that filesystem on the common directory root.
for /full/filesystem:
make a 500Mb block file:
o dd if=/dev/zero of=/full/filesystem/block_file bs=1024k count=500
make a filesystem in block file with 1024 bytes per inode
o mke2fs -j -i 1024 /full/filesystem/block_file
mount the new filesystem
o mount -o loop /full/filesystem/block_file /mnt
move a bunch of files to the new filesystem
o mv /full/filesystem/path/to/dir_with_lots_of_files/* /mnt
now loop mount the new filesystem
o umount /mnt
o mount -o loop /full/filesystem/block_file /full/filesystem/path/to/dir_with_lots_of_files
make an entry in /etc/fstab for this.
Now all is as before with the exception that all is not in one filesystem
as far as the backup is concerned.
This is not the best way to do it but might help if you cannot do either
of the other two suggestions.
Conor
--
Conor Daly <conor.daly at cod.homelinux.org>
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/G/S/O d+(-) s:+ a+ C++(+) UL++++ US++ P>++ L+++>++++ E--- W++ !N
PS+ PE Y+ PGP? tv(-) b+++(+) G e+++(*) h-- r+++ z++++
------END GEEK CODE BLOCK------
http://www.geekcode.com/http://www.ebb.org/ungeek/
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!