Skip Navigation Links | |
Exit Print View | |
Oracle Solaris 11.1 Administration: Devices and File Systems Oracle Solaris 11.1 Information Library |
1. Managing Removable Media (Tasks)
2. Writing CDs and DVDs (Tasks)
4. Dynamically Configuring Devices (Tasks)
5. Managing USB Devices (Tasks)
6. Using InfiniBand Devices (Overview/Tasks)
Displaying Information About Files and Disk Space
How to Display Information About Files and Disk Space
How to Display the Size of Files
How to Find Files That Exceed a Specified Size Limit
Checking the Size of Directories
How to Display the Size of Directories, Subdirectories, and Files
How to Display the User Ownership of Local UFS File Systems
Finding and Removing Old or Inactive Files
How to Find and Remove Old or Inactive Files
How to Clear Out Temporary Directories
9. Administering Disks (Tasks)
11. Configuring Storage Devices With COMSTAR (Tasks)
12. Configuring and Managing the Oracle Solaris Internet Storage Name Service (iSNS)
13. The format Utility (Reference)
14. Managing File Systems (Overview)
15. Creating and Mounting File Systems (Tasks)
16. Configuring Additional Swap Space (Tasks)
17. Copying Files and File Systems (Tasks)
Part of the job of cleaning up heavily loaded file systems involves locating and removing files that have not been used recently. You can locate unused files by using the ls or find commands. For more information, see the ls(1) and find(1) man pages.
Other ways to conserve disk space include emptying temporary directories such as the directories located in /var/tmp or /var/spool, and deleting core and crash dump files. For more information about crash dump files, refer to Chapter 1, Managing System Crash Information (Tasks), in Troubleshooting Typical Issues in Oracle Solaris 11.1.
$ ls -t [directory]
Sorts files by latest time stamp first.
Identifies the directory that you want to search.
Example 8-10 Listing the Newest Files
The following example shows how to use the ls -tl command to locate the most recently created or changed files within the /var/adm directory. The sulog file was created or edited most recently.
$ ls -tl /var/adm total 134 -rw------- 1 root root 315 Sep 24 14:00 sulog -r--r--r-- 1 root other 350700 Sep 22 11:04 lastlog -rw-r--r-- 1 root bin 4464 Sep 22 11:04 utmpx -rw-r--r-- 1 adm adm 20088 Sep 22 11:04 wtmpx -rw-r--r-- 1 root other 0 Sep 19 03:10 messages -rw-r--r-- 1 root other 0 Sep 12 03:10 messages.0 -rw-r--r-- 1 root root 11510 Sep 10 16:13 messages.1 -rw-r--r-- 1 root root 0 Sep 10 16:12 vold.log drwxr-xr-x 2 root sys 512 Sep 10 15:33 sm.bin drwxrwxr-x 5 adm adm 512 Sep 10 15:19 acct drwxrwxr-x 2 adm sys 512 Sep 10 15:19 sa -rw------- 1 uucp bin 0 Sep 10 15:17 aculog -rw-rw-rw- 1 root bin 0 Sep 10 15:17 spellhist drwxr-xr-x 2 adm adm 512 Sep 10 15:17 log drwxr-xr-x 2 adm adm 512 Sep 10 15:17 passwd
For more information, see How to Use Your Assigned Administrative Rights in Oracle Solaris 11.1 Administration: Security Services.
# find directory -type f[-atime +nnn] [-mtime +nnn] -print > filename &
Identifies the directory you want to search. Directories below this directory are also searched.
Finds files that have not been accessed within the number of days (nnn) that you specify.
Finds files that have not been modified within the number of days (nnn) that you specify.
Identifies the file that contains the list of inactive files.
# rm `cat filename`
where filename identifies the file that was created in the previous step. This file contains the list of inactive files.
Example 8-11 Finding and Removing Old or Inactive Files
The following example shows files in the /var/adm directory and the subdirectories that have not been accessed in the last 60 days. The /var/tmp/deadfiles file contains the list of inactive files. The rm command removes these inactive files.
# find /var/adm -type f -atime +60 -print > /var/tmp/deadfiles & # more /var/tmp/deadfiles /var/adm/aculog /var/adm/spellhist /var/adm/wtmpx /var/adm/sa/sa13 /var/adm/sa/sa27 /var/adm/sa/sa11 /var/adm/sa/sa23 /var/adm/sulog /var/adm/vold.log /var/adm/messages.1 /var/adm/messages.2 /var/adm/messages.3 # rm `cat /var/tmp/deadfiles` #
For more information, see How to Use Your Assigned Administrative Rights in Oracle Solaris 11.1 Administration: Security Services.
# cd directory
Caution - Ensure that you are in the correct directory before completing Step 3. Step 3 deletes all files in the current directory. |
# rm -r *
Example 8-12 Clearing Out Temporary Directories
The following example shows how to clear out the mywork directory, and how to verify that all files and subdirectories were removed.
# cd mywork # ls filea.000 fileb.000 filec.001 # rm -r * # ls #
Change to the directory where you want to search for core files.
# find . -name core -exec rm {} \;
Example 8-13 Finding and Deleting core Files
The following example shows how to find and remove core files from the jones user account by using the find command.
# cd /home/jones # find . -name core -exec rm {} \;
Crash dump files can be very large. If you have enabled your system to store these files, do not retain them for longer than necessary.
For more information, see How to Use Your Assigned Administrative Rights in Oracle Solaris 11.1 Administration: Security Services.
# cd /var/crash/system
where system identifies a system that created the crash dump files.
Caution - Ensure you are in the correct directory before completing Step 3. Step 3 deletes all files in the current directory. |
# rm *
# ls
Example 8-14 Deleting Crash Dump Files
The following example shows how to remove crash dump files from the system venus, and how to verify that the crash dump files were removed.
# cd /var/crash/venus # rm * # ls