Linux - Adding storage without LVM

> Operating System - Kernel (Windows, Unix, Linux) > Linux / Unix

1 - About

When you add a disk device to your system, you need to add this storage in your Linux environment

When you improve the disk capacity of your Virtual Vmware Machine, you just need to configure the device to mount automatically by updating /etc/fstab

The process of adding storage to a Red Hat Linux system is relatively straightforward. Here are the steps that are specific to Red Hat Linux when you don't use LVM:

  • Partitioning
  • Formatting the partition(s)
  • Updating /etc/fstab

If you use LVM or if you have only increase the capacity of a VMWare virtual disk, see this article : Linux - How to add storage to an OEL 5 update 4 Linux VMWare Machine

Advertising

3 - Steps

3.1 - What is the disk device file name ?

If your disk is a SCSI-based device, it will begin with SD (for ATA-based, with hd). You can search it in the /dev/ directory:

echo /dev/sd*
/dev/sda /dev/sda1 /dev/sda2 /dev/sdb 

or with the dmesg command such as:

dmesg | grep -i "device sd"
SCSI device sda: 167772160 512-byte hdwr sectors (85899 MB)
SCSI device sda: 167772160 512-byte hdwr sectors (85899 MB)
SCSI device sdb: 1048576000 512-byte hdwr sectors (536871 MB)
SCSI device sdb: 1048576000 512-byte hdwr sectors (536871 MB)

Her we can see that we have two disk:

  • /dev/sda (85899 MB)
  • and /dev/sdb (536871 MB)

where he disk /dev/sda has to partitions (/dev/sda1 and /dev/sda2).

3.2 - Partitionning

Once the disk drive has been installed, it is time to create one or more partitions to make the space available to Red Hat Linux.

There are several different ways of doing this:

  • Using parted, another command-line utility program
  • Using the command-line fdisk utility program

For a complete process on how to partition with fdisk, see this red hat article, partitionning section.

Example with fdisk:

fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.


The number of cylinders for this disk is set to 65270.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-65270, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-65270, default 65270):
Using default value 65270
Command (m for help): p
Disk /dev/sdb: 536.8 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       65270   524281243+  83  Linux
Command (m for help): w
The partition table has been altered!

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

3.3 - Formatting the partition

Formatting partitions (ie creating the file system) under Red Hat Linux is done using the mkfs utility program.

However, mkfs does not actually do the work of writing the file-system-specific information onto a disk drive; instead it passes control to one of several other programs that actually create the file system.

This is the time to look at the mkfs.<fstype> man page for the file system you have selected. For example, look at the mkfs.ext3 man page to see the options available to you when creating a new ext3 file system. In general, the mkfs.<fstype> programs provide reasonable defaults for most configurations; however here are some of the options that system administrators most commonly change:

  • Setting a volume label for later use in /etc/fstab
  • On very large hard disks, setting a lower percentage of space reserved for the super-user
  • Setting a non-standard block size and/or bytes per inode for configurations that must support either very large or very small files
  • Checking for bad blocks before formatting
mkfs.ext3 -b 4096 /dev/sdb1

3.4 - Updating /etc/fstab

When a Red Hat Linux system is newly-installed, all the disk partitions defined and/or created during the installation are configured to be automatically mounted whenever the system boots. However, what happens when additional disk drives are added to a system after the installation is done? The answer is “nothing” because the system was not configured to mount them automatically.

You have to change the file /etc/fstab to mount the partition automatically.

# Mounting partition on the disk dev/sdb
/dev/sdb1               /mnt/datafile           ext3    defaults   1       1
# End Mounting partition on the disk dev/sdb

4 - Support

4.1 - mount: /dev/sda3 already mounted or /u01 busy

If you get this error, it's probably that your Linux environement use lvm. Check this article to see the difference : Linux - Adding storage depends of LVM

[root@ebs121 /]# mount /dev/sda3 /u01
mount: /dev/sda3 already mounted or /u01 busy
Advertising

5 - Documentation / Reference

os/linux/storage_adding_without_lvm.txt · Last modified: 2019/03/27 12:11 by gerardnico