UNIX System Management: File system maintenance

Source: Internet
Author: User
Keywords UNIX System Management
Tags check clean up command line delete directory disk disk space file

By completing this chapter, you will be able to do the following things:

Use the DF and Du commands to monitor the size of the active space in the file system

Cleans up file system space by clearing unused files and core files

To clean up the var file system by trimming the log file

To extend a volume group from the command line

To extend a logical volume from the command line

To extend a file system from the command line

1. Monitor disk usage

Use the DF command to check the active space of the file system.

# DF

FileSystem Kbytes used avail%used mounted on

/dev/vg00/lvol5 294912 261523 31352 89% opt

/dev/vg00/lvol4 24576 19333 4978 80% filesystem

/DEV/VG00/MYFS1 16384 1174 14331 2003–4/MYFS1

/DEV/VG00/MYFS2 15893 14006 297 cent/MYFS2

Check the disk space used by each subdirectory in the directory:

# du-sk/myfs2/*

844/myfs2/data1

1327/myfs2/data2

1073/myfs2/data3

10757/myfs2/data4

4/myfs2/lost+found

The system administrator is responsible for monitoring the size of the remaining disk space on the system. The commonly used command is DF. The fields that are displayed are:

FileSystem file Http://www.aliyun.com/zixun/aggregation/10478.html "> block device file name used by the system

Kbytes How much disk space is occupied by the file system (in units K)

Disk space occupied by files that already exist in the used file system

Avail remaining active disk space in the file system

Percentage of disk space occupied by capacity files

Mounted on file system installation point

If you add the-i option, the output adds three fields:

iused the number of inode currently in use by the file system

ifree the number of inode remaining in the file system

The percentage of the number of inode currently used by the%used file system

When you want to know more details, such as how much disk space is used under a directory, you can use the du command. By default, Du displays a block with a 512 byte unit. The execution of this command is recursive, meaning that if this command is executed in the current directory, it returns information about all files and levels of subdirectories under the current directory.

The main options are:

-K in K-byte units

-S displays only the total disk space occupied by the specified directory.

2. Daily Maintenance

Trim the growing log file (trim)

Delete useless core files

Delete large, old files

Extended File System

-to an existing free space

-to a new disk in the volume group

Disk space is usually limited. System administrators should frequently check disk space usage and perform some action to prevent disk space from running out. What the system administrator can do is to monitor growing files, delete core files, cut log files, and delete large files that are not used for long periods of time or archive them.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.