Tag Archives: SMEServer linux hard disk drive installation

Adding new drives to SMEServer as a raid pair

Adding two new 1Tbyte drives into my SMEServer v7.4 as a raid pair for backups. Made good use of the LVM How-To (again!)

Obviously installing the physical drives comes first and they should be recognised by the bios and then as the server booted mine were flagged as /dev/sda and sdb respectively.

Because these are new drives and I am adding them rather than modding the current drives I am working in the normal console.

#fdisk /dev/sda
>p –print the current state (should show as blank)
>n –add a new partition
>p –primary partition
>1 –partition number
>t –change the type or id of the drive
>hex= fd –change to Linux raid
>p –print again the details and shows now as approx 1T lvm partition
>w –write the partition table and exit

repeat for /dev/sdb

#shutdown -r now

Restarting the server should automatically match the two drives as a raid pair.  Check by reading through

#cat /var/log/dmesg

for something like this:

md: Autodetecting RAID arrays.
md: could not bd_claim hda1.
md: could not bd_claim hda2.
md: could not bd_claim hdb1.
md: could not bd_claim hdb2.
md: autorun …
md: considering sdb1 …
md:  adding sdb1 …
md:  adding sda1 …
md: created md3
md: bind
md: bind
md: running:
raid1: raid set md3 active with 2 out of 2 mirrors
md: … autorun DONE.

Next check what is showing for LVM

#pvscan

PV /dev/md2   VG main            lvm2 [186.19 GB / 64.00 MB free]
PV /dev/md3                      lvm2 [931.51 GB]
Total: 2 [1.09 TB] / in use: 1 [186.19 GB] / in no VG: 1 [931.51 GB]

shows my new pair ready for inclusion in the LVM volume groups and logical volume.

Here I ran into an annoyance with a message Insufficient Extents.

I figure I want the whole disk and the above indicates 931.51G is free

lvm> lvcreate /dev/backups -L931.51G -n backups
  CTRL-c detected: giving up waiting for lock
  Rounding up size to full physical extent 931.51 GB
  Insufficient free extents (238466) in volume group backups: 238467 required

I have since learnt that lvm does some rounding and that using the ‘byte’ size is not the best option.

vgdisplay
  — Volume group —
  VG Name               backups
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  8
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                0
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               931.51 GB
  PE Size               4.00 MB
  Total PE              238466
  Alloc PE / Size       0 / 0
  Free  PE / Size       238466 / 931.51 GB
  VG UUID               #######################

In the above screen the important bit is the “Total PE              238466” which tells me the Physical Extents available.

Changing my command to create the lv so that I use the PE rather than byte value

lvm> lvcreate /dev/backups -l238466 -n backups
  Logical volume “backups” created
lvm>

gives a successful outcome.

lvm> lvscan
  ACTIVE            ‘/dev/main/root’ [184.19 GB] inherit
  ACTIVE            ‘/dev/main/swap’ [1.94 GB] inherit
  ACTIVE            ‘/dev/backups/backups’ [931.51 GB] inherit 

Next to format the new backups volume

#mke2fs /dev/backups/backups

Add the journalling

#tune2fs -j /dev/backups/backups

Edit fstab to add the mounting of this drive by inserting this line

/dev/backups/backups /backups ext3 usrquota,grpquota 1 1

and create the mount point – in my case – /backups

#mkdir /backups

Then one final restart of the server to see that it all starts ok and its done.