Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Replacing a drive in a Btrfs RAID 0 pool

Featured Replies

Hello,

 

I have a Btrfs RAID 0 pool made up of two disks. It’s not a cache pool but a storage pool where I keep movies and TV shows until I watch them.

 

I want to replace one of the disks with a new one. What’s the best way to do this without losing any data?

 

image.thumb.png.6e72f617bc5487327e6c6b3a5ac432c6.png

Solved by JorgeB

  • Community Expert

You would need to do it manually, and have both devices connected at the same time, GUI only supports replacing devices for redundant pools, I can post the commands if needed.

  • Author
40 minutes ago, JorgeB said:

I can post the commands if needed.

 

That will be helpful. Thanks!

  • Community Expert
  • Solution

First format the new device with the UD plugin, you can use any filesystem, it's just to create the partition, then type:

 

btrfs replace start -f /dev/sdX1 /dev/sdY1 /mnt/tmp

 

Replace X with source, Y with target, note the 1 at the end of both, you can check replacement progress with:

 

btrfs replace status /mnt/tmp

 

Once the replacement finishes, you need to reimport the pool, are you on 6.12 or 7.0 since the steps are a little different?

 

  • Author

I am using 6.12.14

 

During the btrfs replace process, should I stop the array / docker / VMs?

Edited by StancuFlorin

  • Community Expert
4 minutes ago, StancuFlorin said:

During the btrfs replace process, should I stop the array / docker / VMs?

No, the filesystem must be mounted, but if possible, avoid large i/o on that pool, or it will slow down the replacement.

 

To re-import the pool:

 

stop array

unassign both pool devices

start array

stop array

reassign the new pool devices

start array

  • Author

Thanks JorgeB for all the details.

 

After giving it more thought, I believe it’s a good time to reconsider the type of my "tmp" pool. I’m not entirely comfortable with the current Btrfs RAID 0 setup. While I’m fine with the lack of redundancy, I don’t like the risk of losing data from all disks if one fails. A ZFS RAID 0 pool would have the same issue. I’m now considering options like MergerFS or a secondary array pool without a parity disk (but this is not possible in unRAID 6)

 

With Unraid 7 nearing a stable release, will it offer a solution that fits my needs?

 

Thanks!

  • Community Expert

Unraid 7 no longer requires the array, except for that, the available storage options are the same, array and btrfs or zfs pools.

  • 3 weeks later...
  • Author

@JorgeB - I have upgraded the system to Unraid 7 before replacing the disk.

 

What are steps to re-import the pool in Unraid 7?

 

Thanks!

  • Community Expert

on main click on the first device for that pool and then "remove pool"
back on main, create a new pool with the same name and number of slots
assign the pool device(s), leave the filesystem set to auto
start the array to import the pool

  • Author

Unfortunate, the new pool is not starting. The replace btrfs operation as been completed last night

 

root@Tower:~# btrfs replace status /mnt/tmp
Started on 21.Jan 22:32:58, finished on 22.Jan 01:41:55, 0 write errs, 0 uncorr. read errs

 

I did a btrfs check on the pool devices and seems to be fine

 

root@Tower:~# btrfs check /dev/sdc1
Opening filesystem to check...
Checking filesystem on /dev/sdc1
UUID: 76e847ca-9587-437b-9669-2b6fb99e8d85
[1/8] checking log skipped (none written)
[2/8] checking root items
[3/8] checking extents
[4/8] checking free space tree
[5/8] checking fs roots
[6/8] checking only csums items (without verifying data)
[7/8] checking root refs
[8/8] checking quota groups skipped (not enabled on this FS)
found 1747837374464 bytes used, no error found
total csum bytes: 1704778404
total tree bytes: 2144288768
total fs tree bytes: 129597440
total extent tree bytes: 100073472
btree space waste bytes: 219475919
file data blocks allocated: 1745728634880
 referenced 1743125495808


root@Tower:~# btrfs check /dev/sde1
Opening filesystem to check...
Checking filesystem on /dev/sde1
UUID: 76e847ca-9587-437b-9669-2b6fb99e8d85
[1/8] checking log skipped (none written)
[2/8] checking root items
[3/8] checking extents
[4/8] checking free space tree
[5/8] checking fs roots
[6/8] checking only csums items (without verifying data)
[7/8] checking root refs
[8/8] checking quota groups skipped (not enabled on this FS)
found 1747837374464 bytes used, no error found
total csum bytes: 1704778404
total tree bytes: 2144288768
total fs tree bytes: 129597440
total extent tree bytes: 100073472
btree space waste bytes: 219475919
file data blocks allocated: 1745728634880
 referenced 1743125495808

 

image.thumb.png.eef80adf57d79ccb0a161993a33f985f.png

 

I have attached the diagnostics logs.

tower-diagnostics-20250122-1104.zip

Edited by StancuFlorin

  • Community Expert

Post the output from

btrfs fi show

 

  • Author
root@Tower:~# btrfs fi show
Label: none  uuid: 9e7d68c0-a38b-484d-9583-72771ac7f7fb
        Total devices 1 FS bytes used 12.27GiB
        devid    1 size 20.00GiB used 19.99GiB path /dev/loop2

Label: none  uuid: b7237d88-ef94-4c64-9a96-113506ed47eb
        Total devices 1 FS bytes used 1.59MiB
        devid    1 size 1.00GiB used 126.38MiB path /dev/loop3

Label: none  uuid: 76e847ca-9587-437b-9669-2b6fb99e8d85
        Total devices 2 FS bytes used 1.59TiB
        devid    1 size 1.82TiB used 818.06GiB path /dev/sde1
        devid    2 size 931.51GiB used 818.06GiB path /dev/sdc1

 

  • Community Expert

Try doing a manual mount to see the actual error, the one in the diags doesn't help:

mkdir /x
mount -v -t btrfs /dev/sde1 /x

 

Post the output from that, and if it fails, look in the syslog to see if there's more info.

  • Author

Manual mount worked for both disks

 

root@Tower:~# mkdir /x
root@Tower:~# mount -v -t btrfs /dev/sde1 /x
mount: /dev/sde1 mounted on /x.

root@Tower:~# mkdir /y
root@Tower:~# mount -v -t btrfs /dev/sdc1 /y
mount: /dev/sdc1 mounted on /y.

 

I can list the files from /x and /y

Edited by StancuFlorin

  • Author

I solved the issue by removing the "tmp" pool like you said, but I started the array witout the tmp pool for a while.

After that, I stoped the array, recreated the pool (with filesystem auto like you said) and started the array.

 

It might be a bug in unRAID 7.

 

image.thumb.png.7877a8a56e948f43e4a57f6823642f35.png

Edited by StancuFlorin

  • Community Expert

The pool cfg might have been incorrect, and reimporting the pool resets that, glad to hear it's resolved.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.