Linux Disk Utilities

Img_26181_columnharddisk_large_180xFor the last few days I have been thinking about taking a trip to Frys to pick myself up another external disk drive, so that I could have a bit of extra storage for the office, as my personal ISOs seem to be taking up way to much space on my already crowded desktop’s harddrive. Plus I need addtional space if I am ever going to convert my running Windows desktop to a VM that I run inside Kubuntu. For some reason I had the idea to check my giant hardware bin to see if I could round up any additonal harddisks. Lo and Behold to 40gb Maxtors, and an external drive enclosure. WIth all the correct cables, would you belive. Well before I am going to put any of these tiny disks into service I am going to have to verify that both are healthy enought to use. So lets start scanning.

DIsk Utils:

fdisk /dev/hdc
Linux hard drive partitioning utility (DOS has
a utility with the same name). Fdisk’s output shoed that I had a linux partition, which I removed and created a FAT32 partition for use in the office.
cfdisk /dev/hda
Hard drive partitioning utility, menu-based. Some find it easier to use then
the plain-vanilla fdisk.
sfdisk -l -x |more
(as root) List the partition tables (including extended partitions) for all drives on my system.
parted /dev/hda
partition manipulation utility for Linux (ext2), and DOS (FAT and
FAT32) hard drive partition. It is for creation, destroying, moving,
copying, shrinking, and extending partitions. You should really like to
backup your data and carefully read info parted before using it.
Use this one to run filesystem check, which I did on my newly created FAT32 partition

fsck -v /dev/sdc1
fsck 1.40.8 (13-Mar-2008)
dosfsck 2.11 (12 Mar 2005)
dosfsck 2.11, 12 Mar 2005, FAT32, LFN
Checking we can access the last sector of the filesystem
Boot sector contents:
System ID "mkdosfs"
Media byte 0xf8 (hard disk)
       512 bytes per logical sector
     16384 bytes per cluster
        32 reserved sectors
First FAT starts at byte 16384 (sector 32)
         2 FATs, 32 bit entries
  10031616 bytes per FAT (= 19593 sectors)
Root directory start at cluster 2 (arbitrary size)
Data area starts at byte 20079616 (sector 39218)
   2507893 data clusters (41089318912 bytes)
32 sectors/track, 64 heads
         0 hidden sectors
  80291808 sectors total
Checking for unused clusters.
Checking free cluster summary.
/dev/sdc1: 0 files, 1/2507893 clusters

Used to check for bad blocks and display the
results on the screen. Similar to SCANDISK in DOS/Windows.

/var/log$ badblocks -v /dev/sdc
Checking blocks 0 to 40146623
Checking for bad blocks (read-only test): done
Pass completed, 0 bad blocks found

Installed to /sbin/hdparm on my system. hdparm is the utility that is used to control the settings of your hard
drive, both in the kernel and in the drive itself. Its got a nice man page, so check it out. Below are most of the command line options.

-a   get/set fs readahead
-A   get/set the drive look-ahead flag (0/1)
-b   get/set bus state (0 == off, 1 == on, 2 == tristate)
-B   set Advanced Power Management setting (1-255)
-c   get/set IDE 32-bit IO setting
-C   check drive power mode status
-d   get/set using_dma flag
-D   enable/disable drive defect management
-E   set cd-rom drive speed
-f   flush buffer cache for device on exit
-F   flush drive write cache
-g   display drive geometry
-h   display terse usage information
-H   read temperature from drive (Hitachi only)
-i   display drive identification
-I   detailed/current information directly from drive
-k   get/set keep_settings_over_reset flag (0/1)
-K   set drive keep_features_over_reset flag (0/1)
-L   set drive doorlock (0/1) (removable harddisks only)
-M   get/set acoustic management (0-254, 128: quiet, 254: fast)
-m   get/set multiple sector count
-N   get/set max visible number of sectors (HPA) (VERY DANGEROUS)
-n   get/set ignore-write-errors flag (0/1)
-p   set PIO mode on IDE interface chipset (0,1,2,3,4,…)
-P   set drive prefetch count
-q   change next setting quietly
-Q   get/set DMA tagged-queuing depth (if supported)
-r   get/set device  readonly flag (DANGEROUS to set)
-R   register an IDE interface (DANGEROUS)
-s   set power-up in standby flag (0/1) (DANGEROUS)
-S   set standby (spindown) timeout
-t   perform device read timings
-T   perform cache read timings
-u   get/set unmaskirq flag (0/1)
-U   un-register an IDE interface (DANGEROUS)
-v   defaults; same as -acdgkmur for IDE drives
-V   display program version and exit immediately
-w   perform device reset (DANGEROUS)
-W   get/set drive write-caching flag (0/1)
-x   tristate device for hotswap (0/1) (DANGEROUS)
-X   set IDE xfer mode (DANGEROUS)
-y   put drive in standby mode
-Y   put drive to sleep
-Z   disable Seagate auto-power

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s