Set up RAID level 1 at the command line
Q I would like to use LVM and software RAID level 1 on my Red Hat-based server, but due to some administrative issues I'm unable to use the graphical user interface to set it up. Can I do it without going all graphical?
A You can set up RAID and LVM using the text-mode installation, but it is slightly harder that way. A minimum of two disks is needed for RAID 1. Start up the boot process, and when you get to the disk partitioning screen, switch to the free console screen by using Alt+F2. Using fdisk to partition the drives, create a partition of 100MB for a RAID 1 /boot on each of the drives (/boot cannot be a logical volume), and create another partition using the rest of the disk for other filesystems and swap. Change all partition types to fd for "Linux raid autodetect" and don't forget to write the changes to disk. The devices to use with fdisk are /dev/sda and /dev/sdc for SATA devices; /dev/hda and /dev/hdc for IDE drives (IDE drives need to be master device on their own cable); and /dev/sd* for SCSI drives. Create the RAID 1 devices, using the correct partitions:
mdadm --create --verbose /dev/md0--level=raid1 --raid-devices=2 /dev/sda1 /dev/sdb1 mdadm --create --verbose /dev/md1--level=raid1 --raid-devices=2 /dev/sda2 /dev/sdb2
Start the RAID devices:
raidstart /dev/md0 raidstart /dev/md1
See RAID rebuild status:
LVM creation; first create the physical volume:
lvm pvcreate -M 2 --metadatacopies 2 /dev/md1
Next, create a volume group:
lvm vgcreate -A y -M 2 VolGroup00 /dev/md1
lvm vgchange -a y VolGroup00
Finally, create logical volumes (/ (root); /usr; /var; /tmp; /home and swap). Appropriate sizes are indicated by G for gigabytes and M for megabytes.
lvm lvcreate -L 512M -n lvroot VolGroup00 lvm lvcreate -L 10G -n lvusr VolGroup00 lvm lvcreate -L 5G -n lvvar VolGroup00 lvm lvcreate -L 128M -n lvtmp VolGroup00 lvm lvcreate -L 2G -n lvhome VolGroup00 lvm lvcreate -L 1G -n lvswap1 VolGroup00
Logical volumes can be reduced or extended, so they only need to be sufficient size for the installation. When you're done, press Alt+F1 to go back to the Disk Druid. Continue the configuration of the mount points and then the rest of the installation.
- Install Nvidia drivers in SUSE via the command line
- Command line mail
- Restoring data in RAID setup when a disk dies
- Files disappearing on Apache Tomcat server using RAID
- Configuring RAID arrays