Hello to everyone who comes to this forum, I am a newbie here and to UNIX. Well my ? is there a command in UNIX to defrag. I was given a server wich runs SCO UNIX Open Server R5 and tring to learn all I can.

Defragmentation is not an issue with UNIX-based file systems as it is in Windows based systems. You do not need to run any 'defragment programs' in the UNIX environment. Your question is interesting and I will research into why this is so and get back to you. Quite frankly, I've always taken for granted that UNIX filesystems do not require 'user defragmentation routines' and never considered why. Good question.

Here is an explanation of how unix filesystems work as compared to Dos/Windows. Just comes down to better design...

removed html tags for readability --oombera

PxT, Great job of finding the right info! So good, I'll post it. Thanks for a great reply for everyone to learn from :slight_smile:

[Edited by Neo on 01-08-2001 at 06:51 PM]

I was getting a message something to the nature of not having any more sapace in the hard drive. How do I clean up it up and just keep what I need wich is the OS? I think the hard drive has a second partision wich it has Dos.

  1. Delete any files under /tmp
  2. Delete any core files, the command is;
    find / -name core -print
    This will give you a list of core files. You can then run file on them to make sure that they are a core file and not a regular file. To automatically delete any file named core, use;
    find / -name core -exec rm -f {} \;

What OS are you unning? Does is specify which file system is full? run df -k from the prompt and post any filesystems more than 90% full.

When one partition is getting full and there are few options to reduce the size, the normal fix is to move directory trees to new partitions and then create a symbolic link from the new directory node to the old one.

For example, lets say that your /user directory is big because you have a lot of users and /user is in the root partition. You would copy the entire /user directory using either a recursive copy (or TAR) to another partition, for example /usr1. Depending on the actual file system, you could just move the old one (just to be safe) i.e. move /user to /user.old Then you would link /usr1/user to /user using a command like:

ln -sf /usr1/user /user

After you test it and it works OK (always test!) then you can delete/remove the original files. You can't do this if you have active processes from the filesystem (you will get a filesystem busy error) or if your shell is in the directory, BTW. Also, moving dynamic libaries and other core libaries can be done, but requires experience. Suggest you relocate user and temporary files first. It takes a lot of courage to move and relocate system binaries and libs, because one false step can result in a filesystem which must be rebuilt from a boot disk.

[Edited by Neo on 01-10-2001 at 01:06 PM]