Here's is a command that shows several usage and ways of retrieving disk space usage. This disk space usage command is another abused and bypassed linux command that has been repeated over and over again from samples and old linux blog entries among the blog entries around here.
Here's a quick run covering details and samples on how to determine and show disk space (available and free) from your current harddisk using the 'df' linux command.
As root, simply
# df
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda5 27925596 8167952 18316216 31% /
/dev/sda1 46362180 27650596 16356460 63% /data
/dev/sda2 101105 11644 84240 13% /boot
tmpfs 509348 0 509348 0% /dev/shm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Legend:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
First column - disk partition name
Second column - total partition allocation
Third column - total used disk space on the specified disk partition
Fourth column - total free or available disk space on the specified disk partition
Fifth column - equivalent disk space allocation in percentage
Sixth column - mount point name of the specified disk partition
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A human readable harddisk space report covering dummy file system would be
# df -ah
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/dev/sda5 27G 7.8G 18G 31% /
proc 0 0 0 - /proc
sysfs 0 0 0 - /sys
devpts 0 0 0 - /dev/pts
/dev/sda1 45G 27G 16G 63% /data
/dev/sda2 99M 12M 83M 13% /boot
tmpfs 498M 0 498M 0% /dev/shm
none 0 0 0 - /proc/sys/fs/binfmt_misc
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To list down inode information instead of hard disk block usage
# df -ih
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sda5 6.9M 210K 6.7M 3% /
/dev/sda1 5.7M 31K 5.6M 1% /data
/dev/sda2 26K 32 26K 1% /boot
tmpfs 125K 1 125K 1% /dev/shm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A sample disk space output of RAIDed SCSI disks over LVM partitions
# df -vh
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Filesystem Size Used Avail Use% Mounted on
/dev/cciss/c0d0p2 22G 12G 9.1G 56% /
/dev/cciss/c0d0p3 43G 36G 4.5G 89% /backup
/dev/cciss/c0d0p1 99M 20M 75M 21% /boot
/dev/mapper/VolGroup00_home-LogVol00_home
67G 18G 46G 29% /home
/dev/mapper/VolGroup00_var-LogVol00_var
67G 42G 22G 66% /var
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
By default, df does not do 'sync' before the disk usage is retrieved.
To invoke disk sync before showing disk usage information would be
# df -ah --sync
To customize the disk byte block size when checking disk space usage would be:
(assuming a 2K per disk block)
# df -avh -B2048
To retrieve disk usage and file system types using df would be
# df -avhT
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda5 ext3 27G 7.8G 18G 31% /
/dev/sda1 ext3 45G 27G 16G 63% /data
/dev/sda2 ext3 99M 12M 83M 13% /boot
tmpfs tmpfs 498M 0 498M 0% /dev/shm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
***Note the second column that shows the file system types
To show disk space usage with exclusion to specific file system would be
# df -vhT -x tmpfs
Filesystem Type Size Used Avail Use% Mounted on
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/dev/sda5 ext3 27G 7.8G 18G 31% /
/dev/sda1 ext3 45G 27G 16G 63% /data
/dev/sda2 ext3 99M 12M 83M 13% /boot
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
***Note that the tmps file system has been excluded from being listed
To send these disk space reports to your email, simply follow the old link here.
HTH
Subscription
Categories
- HowTos (612)
- Linux Devices (40)
- Linux Diggs (620)
- Linux News (1541)
- Linux Videos (24)
Recent Posts
Blog Archive
-
▼
2007
(340)
-
▼
November
(39)
- HowTo: Strip directory path and filename suffix
- HowTo: Get the Filename Extension Only
- Tailf - watch the linux log file grows
- Fedora 8 with Enlightenment Window Manager
- HowTo: ScreenCasts & Desktop Records via Istanbul
- HowTo: Record Desktop Session via Byzanz
- Linux Scorched 3D Tank Game
- Linux Atomic Battle Tank Game
- HowTo: Display a Tree of Linux Processes
- Howto: 3 Easy Install Steps of Microsoft Fonts in ...
- Howto: Convert PDF to HTML/XML/PNG in Linux
- Livna Repository on Fedora 8
- Linux Action Flight Simulator Game
- Splitting and Merging Multiple Linux Files
- Sort Nth Position of Nth Column of a File in Linux
- Stop, Pause, and Continue A Linux Process
- File Creation without File Opening in Linux
- Concatenate Multiple Files in Linux
- Renaming Files in Linux
- Linux Power Consumption Analysis Tool
- Tail and Head Few Lines of Text Files
- Three Easy Steps for Opera on Fedora 8
- Alternative Search and Replace Tool
- Display Lines Beginning with a Given String
- Spell Check Files via Terminal - Install Howto
- Display Linux Session Jobs
- Get Linux Disk Space and Usage
- Change Linux RunLevels Howto
- Audacious - Install Howto
- Amarok - Howto Install
- Sun Java on Fedora 8 Install HowTo
- My Fedora 8 Diary
- Chikka on Kopete Messenger Howto
- Linux Files and Folders Local Copying
- Linux folders and directories recursive removal
- MailX - Mail Facility via Terminal
- Time zone values interpretation
- Retrieving Linux Standard Base and Distro Information
- Fedora Firstboot
-
▼
November
(39)
Monday, November 19, 2007
Get Linux Disk Space and Usage
Subscribe to:
Post Comments (Atom)
ILoveTux - howtos and news | About | Contact | TOS | Policy
0 comments:
Post a Comment