1

I'm really new to doing stuff with RAID. I did a fresh install of Ubuntu Server 14.03 and made a RAID0 Array of 3 HDDs. I also set up an LVM on another HDD that's not part of the RAID.

The way I set my partitions up is like this:

LVM root - ext 4 /
LVM swap

sda - EFI boot
      ext2 /boot
      lvm

RAID - 3 HDDs part of this

When I start up my system, it says Ionly have 1 TB of space. How can I use the RAID array after installation in the terminal. Those drives have a combined total of 4.8TB that I want to use.

When I do mdadm -D /dev/md0, it brings up this:

/dev/md0:
        Version : 1.2
  Creation Time : Sun Aug 23 03:35:15 2015
     Raid Level : raid0
     Array Size : 4688435712 (4471.24 GiB 4800.96 GB)
   Raid Devices : 3
  Total Devices : 3
    Persistence : Superblock is persistent

    Update Time : Sun Aug 23 03:35:15 2015
          State : clean 
 Active Devices : 3
Working Devices : 3
 Failed Devices : 0
  Spare Devices : 0

     Chunk Size : 512K

           Name : yayu:0  (local to host yayu)
           UUID : 929e7482:a829a482:9b223a7b:8a81e4b2
         Events : 0

    Number   Major   Minor   RaidDevice State
       0       8       17        0      active sync   /dev/sdb1
       1       8       33        1      active sync   /dev/sdc1
       2       8       49        2      active sync   /dev/sdd1

How do I use the array? Any help would be appreciated. Thanks!

1 Answer 1

0

[Removed raid explanation]

If you wanted to use it in the LVM, you don't need the raid, you can add the harddrives (or rather partitions on the hard drive) directly into the LVM and add that to the pool. (https://wiki.ubuntu.com/Lvm)

Here are a few more step by step instructions, that I cannot test ATM. Your comment implies to me that you are afraid of data loss and a novice regarding swraid and LVM. Even a professional does backups before fidling around with stuff like this, make a backup of your data!

Remove the raid, you don't need/want it:

sudo mdadm --stop /dev/md0
sudo mdadm --zero-superblock /dev/sdb
sudo mdadm --zero-superblock /dev/sdc
sudo mdadm --zero-superblock /dev/sdd

(http://ubuntuforums.org/showthread.php?t=884556)

This will delete everything on your three "raid" hard disks:

sudo parted -s /dev/sdb mklabel msdos
sudo parted -s /dev/sdb unit mib mkpart primary 1 100%
sudo parted -s /dev/sdb set 1 lvm on
sudo pvcreate /dev/sdb1 

(http://www.linuxquestions.org/questions/linux-general-1/using-parted-command-to-create-lvm-partitions-4175533903/)

Repeat for /dev/sdc and /dev/sdd

Next you need to find out the name of your volume group and add the drives to the VG:

sudo vgdisplay |grep "VG Name"
sudo vgextend VolumeGroupName /dev/sdb1 /dev/sdc1 /dev/sdd1

Now your Volumegroup should have all your drive space, check with vgdisplay. Now you need to resize your root logical volume. You need to find the name again (lvdisplay) and use sudo lvextend -L +5g VolumeGroupName/LogicalVolumeName to extend it.

Last but not least resize2fs /device/of/your/root/partition to resize the file system. (To find your root partitions device check for example the output of mount.)

Again, don't do this without a backup of your data and please read more about LVM if you want to use it.

6
  • Thanks for the reply. If I add the partitions sdb1, sdc1, and sdd1 to the LVM the amount of space I have will go up? Like I don't want to go to /mnt/data every time I want to add to the HDDs. I want it to use to the space no matter where I place my files on the system. Finally, after creating the file system, it will only delete the data on the 3 HDDs right? Sorry for all the questions, don't want to brick the system.
    – o.o
    Aug 27, 2015 at 13:23
  • Updated, but please be careful. read more than this answer and by god make a backup! Aug 27, 2015 at 14:12
  • Thanks for the explanation. For the superblock command, I had to use sdb1, sdc1, sdd1 as it kept saying unrecognized device if I left out the 1s. Everything else went smooth; however, when I check the total space it still says 1TB (i.imgur.com/rlVmW3Z.png). My volume group says vg size is 5.82TB: i.imgur.com/OZVkmbf.png. lvdisplay says root logical volume is 1TB: i.imgur.com/r0xszzK.png. I was reading up on LVM and can't see anything that might have gone wrong.
    – o.o
    Aug 29, 2015 at 19:37
  • This looks good so far. Try again from the lvextend command onwards. Volumegroups and logical volumes are two different things. Aug 29, 2015 at 20:15
  • And now that I think of it, it might be necessary to run the resizefs command from a recovery system or a live CD. Aug 29, 2015 at 20:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .