I was rebuilding one of my lab boxes which has 4 x SATA drives (2 x 500GB and 2 x 1TB). During the install I configured the Software RAID on the 2 x 500's for the OS, etc.. afterwards I wanted to use Software RAID to mirror the 2 x 1TB.
2 x 500GB - OS, swap, Virtual Machines
2 x 1TB - iSCSI and NFS share to be used by my RHEV 3 lab
I acknowledged (just today) that GPT is the future... so I decided to use GPT to accomplish all of this.
Conversely, if you are still using the MSDOS partition scheme (which is perfectly fine/normal for drives under 2TB), then the following would work also
... more randomness...
2 x 500GB - OS, swap, Virtual Machines
2 x 1TB - iSCSI and NFS share to be used by my RHEV 3 lab
I acknowledged (just today) that GPT is the future... so I decided to use GPT to accomplish all of this.
parted -s /dev/sdc -- mklabel gpt mkpart primary ext4 1 -1 set 1 raid on
parted -s /dev/sdd -- mklabel gpt mkpart primary ext4 1 -1 set 1 raid on
mdadm --create /dev/md127 --level=mirror --raid-devices=2 /dev/sdc1 /dev/sdd1
Conversely, if you are still using the MSDOS partition scheme (which is perfectly fine/normal for drives under 2TB), then the following would work also
echo -e "o\nn\np\n1\n\n\nt\nfd\nw\n" | fdisk /dev/sdc
echo -e "o\nn\np\n1\n\n\nt\nfd\nw\n" | fdisk /dev/sdd
mdadm --create /dev/md127 --level=mirror --raid-devices=2 /dev/sdc1 /dev/sdd1
... more randomness...
pvcreate /dev/md127
vgcreate vg_USS /dev/md127
# iSCSI
lvcreate -L300g -nlv_tgtd vg_USS
mkfs.ext4 /dev/mapper/vg_USS-lv_tgtd
yum install scsi-target-utils iscsi-initiator-utils
echo "/dev/mapper/vg_USS-lv_tgtd /var/lib/tgtd ext4 defaults 0 0" >> /etc/fstab
mkdir -p /var/lib/tgtd
mount /var/lib/tgtd
# NFS
lvcreate -L100g -nlv_nfs vg_USS
mkfs.ext4 /dev/mapper/vg_USS-lv_nfs
echo "/dev/mapper/vg_USS-lv_nfs /export/nfs ext4 defaults 0 0" >> /etc/fstab
mkdir -p /export/nfs
mount /export/nfs
setsebool nfs_export_all_rw on
Comments
Post a Comment