I have installed Debian 7.4 on a server, and through the installer I setup both RAID and LVM for the drive that the OS is installed on. However, now I want to add two 4TB drives in a RAID-1 array to the system, and then add in LVM onto those drives.
The question I have is: do I need to partition the drives before I put them in an array?
Most of the guides that I have seen will do something like this:
mkfs.ext4 /dev/sdb #create /dev/sdb1
mkfs.ext4 /dev/sdc #create /dev/sdc1
mdadm --create --verbose /dev/md0 --level=mirror --raid-devices=2 /dev/sdb1 /dev/sdc1
mkfs.ext4 /dev/md0 #create a filesystem table on the RAID array
#LVM creation on the RAID array
vgcreate vg_name /dev/md0
lvcreate -n lv_name -l100%FREE vg_name
mkfs.ext4 /dev/mapper/vg_name-lv_name
mount /dev/mapper/vg_name-lv_name /mount_point
However, I have just tried the following in a VM, which appears to work properly:
mdadm --create --verbose /dev/md0 --level=mirror --raid-devices=2 /dev/sdb /dev/sdc
#LVM creation on the RAID array
vgcreate vg_name /dev/md0
lvcreate -n lv_name -l100%FREE vg_name
mkfs.ext4 /dev/mapper/vg_name-lv_name
mount /dev/mapper/vg_name-lv_name /mount_point
Is there any difference between these two methods of creating a RAID/LVM array? It seems as though creating a filesystem three times is unnecessary.
mkfs
calls at the beginning of your script. – Gilles 'SO- stop being evil' Mar 10 '14 at 22:06