- Home
- Linux
- Misc
- Windows basic tutorials
- Introduction to windows
- Windows pre-installation
- Windows Installation
- Windows xp desktop
- Log on for the first time
- Windows XP control panel
- Managing Folders in Windows XP
- Outlook Express Setup
- How to import address book in Outlook Express
- Import Ms Exchange inbox file(.pst) into Ms Outlook 2003
- Import Outlook Express email messages into Ms Outlook 2003
- How to mount and unmount usb drive (thumb drive) in Windows
- House keeping - Keep your Windows clean and tidy
- Windows basic tutorials
- CMS
- Blog
- Disclaimer
- Privacy Policy
- Support
- Contact
Linux fdisk command - check hard disk partitions
Submitted by jinlusuh on Sun, 03/01/2009 - 01:40
You need to check your hard disk partitions from time to time to keep your eyes on hard disk usage and to make sure your hard disk is not out of space. Normally, the /home partition always running out of space if you setup Linux as a desktop. It's because you are using a normal user account to do your job and keep all data in /home/ directory. If you setup your Linux as a server, then give most of your hard disk space to the main partition (the mount point). For example, if you setup a web server, then, you should give /var directory a bigger space because all website data will be kept in /var/www/htdocs. That's why it's very important for you to properly plan the hard disk partition and give a proper hard disk space to every mount point (directory) depends on the needs.
This tutorial is about how to check hard disk partitions from an already running Linux operating system using Linux fdisk command. If you are looking for fdisk tutorial to partition your hard disk, check the step by step partition guide with screenshots in Slackware hard disk partition with fdisk tutorial.
Check hard disk partitions with Linux fdisk command
The Linux fdisk command is a popular tool used to create hard disk partitions. Whoever installed Slackware Linux before should be familiar with Linux fdisk command. However, fdisk command also can be used to check hard disk partitions on the running Linux system. It's not only Slackware but you can find fdisk command in other Linux distributions too including Ubuntu. So this tutorial can be used to check hard disk space usage in any Linux distributions.
You need root privileges to run fdisk, otherwise you will have a command not found message if you are using Slackware or Cannot open /dev/sda if you are using Ubuntu like in the example below:
Invoke fdisk command without root privilege in Slackware Linux.
luzar@slackware:~$ fdisk -l |
Invoke fdisk command without root privilege in Ubuntu Linux.
luzar@ubuntu:~$ fdisk -l /dev/sda |
You can use su - in Slackware and for Ubuntu, you can use sudo command to gain root privilege.
Slackware example:
luzar@slackware:~$ su - |
Ubuntu example:
luzar@ubuntu:~$ sudo fdisk -l /dev/sda |
Here is a part of manual page for Linux fdisk command. The important part is the SYNOPSIS which will be our reference in all the examples.
NAME |
We can use the second syntax in the synopsis above to check hard disk partitions in our current system. If we want to check the first hard disk in Linux system, issue fdisk command and the first hard disk. See example below:
root@slackware:~# fdisk -l /dev/sda |
The Linux fdisk -l option if invoked without giving specific hard disk, will print hard disk based on data found in the /proc/partitions.
root@slackware:~# fdisk -l |
The result above shows all hard disk used in the current Linux system. If we want to print size in sector instead of cylinder, add -u option with the command. See example below:
root@slackware:~# fdisk -l -u /dev/sda |
We can display the size of partition in block using fdisk - s option. However we need to provide the partition name. See the example below:
root@slackware:~# fdisk -s /dev/sda4 |
That's all. Now you can check your hard disk usage with Linux fdisk command and take appropriate action before any partition runs out of space. Remember to check hard disk space regularly or you can write a script to let you know if a certain partition is reaching the limit.
Back to Linux basic commands main page.

Add new comment