NetAdminTools.com
 
SignalQ Sites:
NetAdminTools - Coprolite - NoNIC - SpotBridge - NAW
RoboCoop - AreWeDown - SolarPower - SysAdminTools
Xfig - Gold Loaf - GeekPapa - FixGMC - MCJ - FixRambler
Categories:
GNU/Linux | Homebrew designs | Perl | Administration | Backup/Recovery | Bugs/Fixes | Certification | Database | Email | File/Print | Hardware | Information Grab Bag | Interoperability | GNU/Linux ABCs | Monitoring | Name Resolution | Network Services | Networking | Remote Control | Security | Desktop | Web | BSD | Solaris | GIAGD | REALbasic

Last 30 Days | Last 60 Days | Last 90 Days | All Articles | RSS | Hail Support


Categories:
·GNU/Linux
·Homebrew designs
·Perl
·Administration
·Backup/Recovery
·Bugs/Fixes
·Certification
·Database
·Email
·File/Print
·Hardware
·Information Grab Bag
·Interoperability
·GNU/Linux ABCs
·Monitoring
·Name Resolution
·Network Services
·Networking
·Remote Control
·Security
·Desktop
·Web
·BSD
·Solaris
·GIAGD
·REALbasic
·All Categories


Adding a RAID1 Device to a Volume With LVM
Topic: GNU/Linux   Posted:2004-10-03
Printer Friendly: Print

spacerspacer
In this article, we freed up a disk from our volume so that we could reconfigure our system. In this article we will create and add a RAID1 device to our volume group. We removed /dev/sdg from our volume group, and /dev/sdh was unused, so let's create a RAID1 device to add to our volume group. [Note: Before you do anything involving your partitions or volumes, make a complete backup. Make sure to set up a test system with the same kernel and distribution to see how this stuff works. This article was written using our lab box. Read our terms of use. Note that this article was written using a Fedora RC 1 distribution and a generic 2.4.24 kernel.] First, we need to create a raidtab file:

[root@srv-1 root]# cat /etc/raidtab
raiddev /dev/md0
raid-level      1
nr-raid-disks   2
persistent-superblock 1
chunk-size      4
device          /dev/sdg
raid-disk       0
device          /dev/sdh
raid-disk       1
[root@srv-1 root]#

We need to prepare the partitions:

[root@srv-1 root]# fdisk /dev/sdh
Command (m for help): p
Disk /dev/sdh: 4294 MB, 4294817280 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot    Start       End    Blocks   Id  System
Command (m for help): n
Command action
e   extended
p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-522, default 1): 
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-522, default 522): 
Using default value 522
Command (m for help): 
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): fd
Changed system type of partition 1 to fd (Linux raid autodetect)
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@srv-1 root]# 
[root@srv-1 root]# fdisk /dev/sdg
.
.
.

Let's create the physical volume and extend the volume group:

[root@srv-1 root]# pvcreate /dev/md0
pvcreate -- physical volume "/dev/md0" successfully created
[root@srv-1 root]#
[root@srv-1 root]# vgextend volgroup /dev/md0
vgextend -- INFO: maximum logical volume size is 255.99 Gigabyte
vgextend -- doing automatic backup of volume group "volgroup"
vgextend -- volume group "volgroup" successfully extended
[root@srv-1 root]#
[root@srv-1 root]# pvscan
pvscan -- reading all physical volumes (this may take a while...)
pvscan -- ACTIVE   PV "/dev/md0" of VG "volgroup" [3.99 GB / 3.99 GB free]
pvscan -- ACTIVE   PV "/dev/sde" of VG "volgroup" [3.99 GB / 1016 MB free]
pvscan -- ACTIVE   PV "/dev/sdf" of VG "volgroup" [3.99 GB / 3.99 GB free]
pvscan -- WARNING: physical volume "/dev/sdg" belongs to a meta device
pvscan -- WARNING: physical volume "/dev/sdh" belongs to a meta device
pvscan -- total: 5 [12 GB] / in use: 5 [12 GB] / in no VG: 0 [0]

Looks good.

There are six articles in this series:
Setting Up Logical Volume Manager
Extending a Logical Volume
Shrinking a Logical Volume With LVM
Adding a RAID1 Device to a Volume With LVM
Upgrading LVM To Version 2 and Patching The Linux Kernel
Finish Conversion And Expansion to Two RAID1 Devices With LVM




Please read our Terms of Use
Microsoft, Windows, Windows XP, Windows 2003, Windows 2000, and NT are either trademarks or registered trademarks of Microsoft Corporation. NetAdminTools.com is not affiliated with Microsoft Corporation. Linux is a registered trademark of Linus Torvalds, and refers to the Linux kernel. The operating system of most distributions that contain the Linux kernel is GNU/Linux. All logos and trademarks in this site are property of their respective owner. Copyright 1997-2008 NetAdminTools.com

Created by:
MCJ
MCJ CMS