Packetwatch.net

SSD drive in Red Hat Enterprise Linux



Last modified: Jan. 24, 2013

Contents
1 - Summary
2 - Detect drive
3 - Create partition
4 - Format partition
5 - Mount partition


1 - Summary

This guide will show how to use install a new SSD drive in Red Hat Enterprise
Linux. It explains how to create a partition, format it and mount it. This has
been tested in Red Hat Enterprise Linux 6.


2 - Detect drive

You can find the SSD drive by typing the following. The server being used in
this example has other drives, but I've not listed them as this guide is about
SSD drives. In this example, we have a Samsung SSD 830 plugged into a HighPoint
Rocket 640L SATA controller.
# sudo parted -l | sed -n '/^Model: /,/^Disk /p'
[sudo] password for user: 
Model: ATA SAMSUNG SSD 830 (scsi)
Disk /dev/sda: 256GB

Get more information about this drive by typing the following.
# dmesg | grep sda | uniq
sd 0:0:0:0: [sda] 500118192 512-byte logical blocks: (256 GB/238 GiB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
 sda:
 sdc: sda1
sd 0:0:0:0: [sda] Attached SCSI disk
 sda: sda1


3 - Create partition

Use fdisk to create the partition.
# sudo fdisk /dev/sda
[sudo] password for user:

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): p

Disk /dev/sda: 256.1 GB, 256060514304 bytes
255 heads, 63 sectors/track, 31130 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: 0xf5a14aa4

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-31130, default 1): 1
Last cylinder, +cylinders or +size{K,M,G} (1-31130, default 31130): 31130

Command (m for help): p

Disk /dev/sda: 256.1 GB, 256060514304 bytes
255 heads, 63 sectors/track, 31130 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: 0xf5a14aa4

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1       31130   250051693+  83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.


4 - Format partition

Red Hat Enterprise Linux 6 comes with TRIM support for SSD drives. TRIM support
for SSD drives is only supported in ext4 file systems so we will format the
partition as ext4.
# sudo mkfs.ext4 /dev/sda1
[sudo] password for user:
mke2fs 1.41.12 (17-May-2010)
Discarding device blocks: done                            
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
15630336 inodes, 62512923 blocks
3125646 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
1908 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
        4096000, 7962624, 11239424, 20480000, 23887872

Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 22 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.


5 - Mount partition

Create a mountpoint for the partition.
# sudo mkdir /ssd
[sudo] password for user:

Change the label of the partition.
# sudo e2label /dev/sda1 /ssd
[sudo] password for user:

The /etc/fstab file will need to be updated to include information for mounting
the new partition. Add the following as an example.
  LABEL=/ssd	/ssd	ext4	defaults,discard,nodev,nosuid	1 2 
# sudo cp /etc/fstab /etc/fstab.example
[sudo] password for user:
# sudo vi /etc/fstab
[sudo] password for user:

Mount the partition.
# sudo mount /dev/sda1 /ssd
[sudo] password for user:


Last modified: Thu Jan 1 00:00:00 1970 UTC
Packetwatch Research 2002-2024.