Commands for Server File System Info

The drives on your dedicated server contain priceless information. It is so important that you probably spend a good amount of time making sure your backups are sound and your security is air tight. To keep your file system running in good condition, it is vital that you stay informed and know its inner workings. The following Linux / Unix command can help you maintain a level of working knowledge about your server’s filesystem.

df – This command reports disk usage information about your file system. It displays the amount of disk usage for each mounted file system. For example

df -h

Will print the output like this:

Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             224G   48G  165G  23% /
none                  871M  664K  870M   1% /dev
none                  880M  532K  879M   1% /dev/shm
none                  880M  132K  880M   1% /var/run
none                  880M     0  880M   0% /var/lock

fdisk – With the fdisk command, you can manipulate partition tables or simply display information about them. The most basic command to list partitions is:

fdisk -l

And the output will look like this:

Disk /dev/sda: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000b93e0

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       29637   238053376   83  Linux
/dev/sda2           29637       30402     6142977    5  Extended
/dev/sda5           29637       30402     6142976   82  Linux swap / Solaris

du – This command will display estimated disk space usage for each file and directory specified. For example, to view usage info on all files, type:

du -a

For more information about any of these commands, type “man” followed by the command name from your shell prompt.