Re: ext2fs: do directories ever shrink?

Kevin K. Sochacki (kksocha@erenj.com)
Wed, 15 Jul 1998 13:07:34 -0400


Clifford Wolf wrote:
>

> On does not need to modify fsck to "shrink" directories at boot time -
> this shell script should do the job (i've not tested it now and it's not
> perfect - but it shows the basic idea):
>
> find / -type d -fstype ext2 |
> while read dirname
> do
> mkdir $dirname.new_version
> mv $dirname/* $dirname.new_version/

if you replace the first 'mv' command with the follow command
permissions and time stamps will be preserved.
find $dirname/ | cpio -pam $dirname.new_version/

> rmdir $dirname
> mv $dirname.new_version $dirname
> done
>
> One of the problems with this script is that it does not preserve the
> permissions of the directories. The fact that it creates new directories
> with new inode numbers shouldn't be a problem since it is started at boot
> time.
>
> It is easier to preserve the permissions useing a little C-Programm.
>
> - clifford
>
> -- -- -- -- -- -- -- -- -- -- -- -- --
> Clifford Wolf
> magnet - Internet at Work IRC: efnet / clifford
> Director of System Development http://www.clifford.at/
> e-mail: c.wolf@magnet.at email: god@clifford.at
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.rutgers.edu
> Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html

-- 
(...Later..:)
         _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
        _/                        _/ Exxon Research & Engineering   _/
       _/ _/_/_/ _/_/     _/_/_/ _/ Kevin K. Sochacki              _/
      _/ _/     _/  _/   _/     _/ ICSBS CC124 (908) 730-2911     _/
     _/ _/_/_/ _/_/   & _/_/_/ _/ mailto:kksocha@erenj.com       _/
    _/ _/     _/ _/    _/     _/ PERSONAL                       _/
   _/ _/_/_/ _/  _/   _/_/_/ _/ mailto:kks@superlink.net       _/
  _/                        _/ http://mars.superlink.net/kks  _/
 _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html