Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 

 
 

Disk and Filesystem Commands

Linux Tips by Burleson Consulting

In this chapter we'll handle some basic methods for examining disks and partitions in Linux.  These commands need to be used carefully as it would be easy to accidentally erase data, and that's never good!

Before we talk too much about partitions and mount points it is important to understand that a Linux mount point can be anywhere you could put a directory.  While at the base of any Linux system there is a / directory, commonly called the root directory a partition may be mounted anywhere below that.  Here are some examples of common mount points and what you might find there:

Mount Point

Contents

/

the slash partition is where everything starts

/boot

contains essential boot files

/usr/local

reserved for installed software 'local' to this computer

/tmp

temporary files for this system or any applications on it

Here we see that /usr/local is listed as a partition; however, it does not come directly below the root (/) partition.  This takes a little getting used to, but just be aware that a disk partition can be mounted anywhere.

Displaying File System Information

It is very common to have to examine disk use to determine where there is free space, where the disk may be nearing full and where you may need to add disk or move files.  One of the most essential commands used to examine disks is the df command.

The df command is used to display information about mounted file systems.  By default the df command will typically return disk information in kilobytes.  Since there can be variation on this default behavior it is often nice to use the ?k option which will force df to displays disk space usage in kilobytes as seen in this example:

$ df -k

Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/hdf1             18727836   2595832  15180656  15% /
/dev/hda1               101086      5945     89922   7% /boot
none                    128560         0    128560   0% /dev/shm

These results show that two file systems are mounted.  The Filesystem column of the output shows the path to the disk device which is currently mounted at the Mounted on location.  The 1K-blocks column displays the size of the entire partition while the Used and Available columns indicate the number of 1K blocks on that device used and available.  The Use% column will show what percentage of the disk is currently used and is the quickest way to identify disks which are getting full.

To get the display in a friendlier format, the ?h option can be used:

$ df -h

Filesystem            Size  Used Avail Use% Mounted on
/dev/hdf1              18G  2.5G   15G  15% /
/dev/hda1              99M  5.9M   88M   7% /boot
none                  126M     0  126M   0% /dev/shm

The  -h option will show output in the familiar gigabyte, megabyte or kilobyte (G, M or K respectively) scales.  This makes things more human readable, hence the h.

It is easy to see that the first file system is 18GB in size, with 2.5GB used and 15GB of available free space. It is mounted on the root (/) mount point.

The second file system is 99MB in size, with 5.9MB used and 88MB of available free space. It is mounted on the /boot mount point.

This output also shows a shared memory space of 126MB currently available (/dev/shm).

Creating a File System

Some file systems are created automatically during the Linux installation process.  For instance, when I set up a system with Fedora Core 2 (Red Hat) for this book, the installation tool detected the two disk drives and offered to automatically configure their partitions and setup a file system.

There are many different types of file systems. Microsoft Windows administrators are familiar with filesystems like FAT16, FAT32, and NTFS.  The comparable options on Linux are ext2, ext3, and Linux-swap.  The differences between these filesystem types are beyond the scope of this book.

During the lifetime of a Linux system it is not uncommon to want to add additional disk space to a system by adding disks or replace a current drive with a larger capacity.  Here are some of the most useful commands for setting up disks:

Note:  You will need root privileges to to perform most of these tasks.

Command

Function

fdisk

Partition a hard disk

fsck

Check and optionally repair one or more Linux file systems

mkdir

Make a new file directory

mkfs

Make a file system

mkswap

Make a swap area on a device or in a file

mount

Mount a file system (umount to unmount)

parted

Disk partitioning and partition resizing program.  It allows the user to create, destroy, resize, move and copy ext2, ext3, Linux-swap,  FAT  and FAT32 partitions.

sfdisk

List the size of a partition, the partitions on a device, check the partitions on a device, and repartition a device.

Table 3.1: Commands for file system creation


This is an excerpt from "Easy Linux Commands" by Linux guru Jon Emmons.  You can purchase it for only $19.95 (30%-off) at this link.


 

 

  
 

 
 
 
 
 

 
 
 
 
 
 
Oracle training Excel
 
Oracle performance tuning software 
 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright ? 1996 -  2014

All rights reserved by Burleson

Oracle ? is the registered trademark of Oracle Corporation.