Page 1 of 4 123 ... LastLast
Results 1 to 10 of 40

Thread: adding raid 1 to existing server. ( what next)

  1. #1
    Join Date
    Sep 2020
    Beans
    41

    adding raid 1 to existing server. ( what next)

    I'm adding a raid 1 to my existing server, i'm going to be using the current sdb as a backup drive and want to have raid 1 on it.
    --
    current server info:
    sda - ( boot drive ) -- no raid
    ata disk
    160 MB
    Partioned partioned : dos
    sdb - ( share drive) -- no raid -- samba for window access -- to allow backup of windows system files to sdb drive. ( docs, pics, etc..)
    ata disk
    1tb
    Partioned partioned : dos
    --
    where i am with the server:
    added second 1tb drive (sdc) as is and did not do anything else to it.
    so drives are now, lshw -- sees all three drive ( as listed )

    sda - ( boot drive ) -- no raid
    ata disk
    160 MB
    Partioned partioned : dos
    sdb - ( share drive) -- no raid -- samba for window access
    ata disk
    1tb
    Partioned partioned : dos

    sdc - (was from windows 7 system -- still format as a windows drive -- still has Window 7 OS and other data -- I do not need)
    ata disk
    1tb
    Partioned partioned : dos

    --
    status so far:

    Tested sdc by -- mkdir /media/drive and mounting /dev/sdc -- got msgs (wrong FS type bad option ....)
    but cd to drive and
    df command did show two lines
    root root .
    root root ..

    --
    question :

    1) do I need to format sdc? or will the Madam command take care of it? ( i assume that sdc will be written over, and to the same format as sdb, yes? no?)
    2) I assume all I need to run is the following (only?)
    sudo madam --create --verbose /dev/md0 --force --level=1 --raid-device=1 /dev/sdb ( some examples show /dev/sdb1 do i need the number?)
    sudo madam --grow /dev/md0 --raid-device=2 --add /dev/sdc ( again do i need to add a number)

    i assume the --grow will overwrite the format on the sdc drive to match sdb.

    3) do i need to change the auto mount param, ( it is currently mounting sdb as /media/drivesdb on boot up)
    or do i need to tell the system to mount the raid ( edit fstab to add /media/drivesdb /dev/md0 or edit the exist entry, or do nothing)



    Tia
    Tim

  2. #2
    Join Date
    Nov 2009
    Location
    Catalunya, Spain
    Beans
    14,560
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: adding raid 1 to existing server. ( what next)

    Hold on. You have couple of big mistakes...

    Most important, if sdb curently has the data you need, you don't start by creating the array with sdb. You do it with the new disk, sdc.

    And yes, it is better to have a number, like /dev/sdc1, because that means partition #1. It is better to use partitions for mdadm even though it can work with disk designator like /dev/sdc.

    Also, you will create the array as 2 disk raid1 array, with one disk missing. That allows you to simplify things and you avoid doing grow later.

    So your first step is to create new partition table on sdc to remove the current ntfs partitions. You said you DON'T need the data, right??? I don't know which tool you prefer, I myself prefer parted in the command line. And even though it is not necessary for a disk of 1TB, it is preferred to use gpt table, no msdos.

    It is also best to check total number of MiB that sdb and sdc have. The disks are 1TB but the exact number of MiB might differ slightly. This is why I create the partition to end around 15-20MiB before the end of the disk. That way it allows new disk in the future to be able to have a partition of the same size.

    You can check total number of MiB and other basic data of each disk with:
    Code:
    sudo parted /dev/sdb unit MiB print
    sudo parted /dev/sdc unit MiB print
    Darko.
    -----------------------------------------------------------------------
    Ubuntu 18.04 LTS 64bit

  3. #3
    Join Date
    Nov 2008
    Location
    Boston MetroWest
    Beans
    16,326

    Re: adding raid 1 to existing server. ( what next)

    I would create a single partition on each of sdb and sdc. I use fdisk for this task so I can mark the partitions as type "fd" which is the code for RAID component.

    This will obviously destroy all the data on both drives.

    Next you would create a RAID1 array using mdadm (not "madam"):
    Code:
    sudo mdadm /dev/md0 --create --level=1 --raid-devices=2 /dev/sdb1 /dev/sdc1
    Then you can format the array with whatever filesystem you need. For a standard ext4 Linux filesystem, you'd use
    Code:
    sudo mkfs -t ext4 /dev/md0
    Then specify a mount point in the filesystem and add the array to /etc/fstab. I'd use "sudo blkdid" to find its "UUID", then use the UUID in /etc/fstab.
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  4. #4
    Join Date
    Sep 2020
    Beans
    41

    Re: adding raid 1 to existing server. ( what next)

    Thanks darkod And SeijiSensei

    i did not mention that I backup the SDB drive and if I loose the data on SDB, i have it else where.

    i'll be using both of your suggestions to create my raid. i hope to have it created soon.

    again thanks.


    Tim

  5. #5
    Join Date
    Mar 2007
    Beans
    1,325

    Re: adding raid 1 to existing server. ( what next)

    Assuming you get the partition sdc1 right you can make it a 2 disk raid 1 array with a missing disk, copy everything on to sdc1 then repartition sdb and add sdb1 to the array you set up.

  6. #6
    Join Date
    Sep 2020
    Beans
    41

    Re: adding raid 1 to existing server. ( what next)

    sdc1 is a 1TB drive. ( so is sdb1)

    Question,

    when running fdisk /dev/sdc1
    I enter n them p
    the following is displayed


    device size type ( i think it said type)
    /dev/sdc1p1 835.5g qnx4. ...
    /dev/sdc1p2 259.6g unknown
    /dev/sdc1p3 259.5g unknown
    /dev/sdc1p4 26.9m speedstor

    I assume that these are the window partition, that were leftover, and the Px are the partition number
    do I want to have one partition for my raid or will Mdadm fix that? ( or do I delete the partitions first then create a new partition on sdc1)
    also do I need repartition sdb1? ( seeing that it is ext4 already)

    fdisk -l
    shows
    sdb1 as 1 device 931.5 in size and Linux lvm
    sdc1 as 1 device 931.5 in size and hpfs/ntfs/exfat ( I assume I need to have it changed to Linux lvm)

    Thank you

  7. #7
    Join Date
    Nov 2009
    Location
    Catalunya, Spain
    Beans
    14,560
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: adding raid 1 to existing server. ( what next)

    You need to repartition any disk that was used before. You want it to be with new clean partition table, like new. So that means you need to repartition both sdb and sdc.

    You might have sdb1 as ext4 right now, but with mdadm the sdb1 does not carry any filesystem. The filesystem will be on the raid array device, like /dev/md0.

    You can use fdisk or parted, which ever you prefer. But start by creating new empty gpt partition table. Of course, this will destroy all data on both disks but you said you are OK restoring that from backups.

    I still think best approach is to create the array with sdc1 and one member missing, copy the data from current sdb1, then repartition sdb to add the new sdb1 to the array. From internal to internal HDD it would copy the data much faster.

    If your backup is on external USB for example, copying back from it would take much longer than from internal HDD.

    But the choice how you handle this operation is on you.
    Darko.
    -----------------------------------------------------------------------
    Ubuntu 18.04 LTS 64bit

  8. #8
    Join Date
    Sep 2020
    Beans
    41

    Re: adding raid 1 to existing server. ( what next)

    ok,
    when I tried to create a new partition on /dev/sdc1

    fdisk displayed the following,


    device size type ( i think it said type)
    /dev/sdc1p1 835.5g qnx4. ...
    /dev/sdc1p2 259.6g unknown
    /dev/sdc1p3 259.5g unknown
    /dev/sdc1p4 26.9m speedstor

    so do I delete the existing partition first? then create a new single partition?

    sorry about not knowing the steps to take, still new to Ubuntu.

  9. #9
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: adding raid 1 to existing server. ( what next)

    I saw a number of questions asked above which still haven't been answered. Commands run.

    Tip: If you'd like good help, answer the questions. Run the commands. Post the output.

    Tip: Don't interpret the output. Just post it WITH THE EXACT COMMAND RUN.

    Tip: whenever posting commands and output, use forum code-tags so it looks like it did in the terminal. This is a simple copy/paste thing. Nobody is asking for any extra work, no font changes, nothing like that. https://ubuntuforums.org/misc.php?do=bbcode#code

    Please.

  10. #10
    Join Date
    Nov 2008
    Location
    Boston MetroWest
    Beans
    16,326

    Re: adding raid 1 to existing server. ( what next)

    Quote Originally Posted by tross9 View Post
    ok,
    when I tried to create a new partition on /dev/sdc1

    fdisk displayed the following,

    device size type ( i think it said type)
    /dev/sdc1p1 835.5g qnx4. ...
    /dev/sdc1p2 259.6g unknown
    /dev/sdc1p3 259.5g unknown
    /dev/sdc1p4 26.9m speedstor
    In fdisk, "d(elete)" all the partitions, then use "n(ew)" to create a new partition that spans the entire disk. Use the "t(ype)" command to mark it as type "fd". Then "w(rite)" the results to the drive. Do the same to the other disk to be used in the array. Then run mdadm --create to bind the partitions together.
    Last edited by SeijiSensei; January 8th, 2021 at 05:31 PM.
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

Page 1 of 4 123 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •