2

I have a CentOS 7.7 server which has a vhd /dev/sdc mounted (format-type= btrfs); it contains data.

I attached a empty vhd to the VM, /dev/sdd (I didn't partition this disk using fdisk)

lsblk command lists the attached disk but no mount point.

used, mdadm --create /dev/md0 --level 0 --raid-devices=2 --name=/data-disk /dev/sdc /dev/sdd

Output:

mdadm: cannot open /dev/sdc: Device or resource busy

Question:

  • Will the data from the disk /dev/sdc get wiped out when I try to create a RAID0 array?

  • I can issue umount /dev/sdc and issue the mdadm --create command, but is that a proper approach to do this.

=== in case of successful RAID0 creation ===

Below command would be executed:

mkfs.btrfs /dev/md0

Editing the /etc/fstab, with the uuid info

===

Trying to add two disks to RAID0, one is already setup as backup, which has data. The new one is attached, could see the disk using lsblk, but

NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sdc      8:32   0    100G  0 disk /cass_backup
sdd      8:48   0    100G  0 disk

df -h

/dev/sdc        100G  82G  20G  20% /data_disk

How does the distribution of data between mounted and unmounted disk done? Do I need to mount the new one (/dev/sdd) first?

1 Answer 1

2

Transforming a single disk to a RAID0 array will break your filesystem. More precisely you would first need to carefully distribute the data of /dev/sdc onto both disks.

You can create a RAID1 array more easily, since RAID1 has identical data on both disks: cf. Converting a single drive system to RAID.

Fortunately you are using btrfs, which combines the power of a filesystem, RAID and LVM. So add the second disk to your btrfs and convert it to a RAID0 array.

Edit: In your case the conversion to RAID0 is as simple as: mounting your original btrfs filesystem (let say on /mnt). Expand the filesystem:

mount /dev/sdc /mnt
btrfs device add /dev/sdd /mnt
btrfs balance start -dconvert=raid0 -mconvert=raid0 /mnt

The data on /dev/sdd will be lost, but data from /dev/sdc will remain.

2
  • Trying to add two disks to RAID0, one is already setup as backup, which has data. The new one is attached, could see the disk using lsblk, but NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sdc 8:32 0 100G 0 disk /cass_backup sdd 8:48 0 100G 0 disk df -h /dev/sdc 100G 82G 20G 20% /data_disk How does the distribution of data between mounted and unmounted disk done? Do i need to mount the new one (/dev/sdd) first?
    – Tim
    Dec 11, 2019 at 21:52
  • 1
    I added more info to the answer. Dec 12, 2019 at 0:07

You must log in to answer this question.

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