Hi, I''m getting an error when trying to delete a device from a raid1 (data and metadata mirrored).> btrfs filesystem showfailed to read /dev/sr0 Label: none uuid: 78b5162b-489e-4de1-a989-a47b91adef50 Total devices 2 FS bytes used 107.64GB devid 2 size 149.05GB used 109.01GB path /dev/sdh1 devid 1 size 156.81GB used 109.03GB path /dev/sdb6 Btrfs v0.20-rc1> btrfs device delete /dev/sdh1 /mnt/raid-data/ERROR: error removing the device ''/dev/sdh1'' - Inappropriate ioctl for device Raid has been working fine for a long time. Both devices are present but /dev/sdh1 is a new empty btrfs partition at the moment. I should like to know whether this is an error or "btrfs device delete" command is not the appropriate one. I just want to know how to delete sdh1 from raid, add a new partition and balance. My kernel version is: 3.8.0-31 Thanks, Alfredo -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Oct 6, 2013, at 5:10 AM, Alfredo Esteban <aedelatorre@gmail.com> wrote:> >> btrfs device delete /dev/sdh1 /mnt/raid-data/ > ERROR: error removing the device ''/dev/sdh1'' - Inappropriate ioctl for deviceIt''s sortof a generic error, I think it''s fixed since I haven''t seen this recently with newer kernels. What do you get in dmesg? Any other messages at the time this command was issued?> > Raid has been working fine for a long time. Both devices are present > but /dev/sdh1 is a new empty btrfs partition at the moment.From your post:>> devid 2 size 149.05GB used 109.01GB path /dev/sdh1109GB used isn''t exactly empty.> I should like to know whether this is an error or "btrfs device > delete" command is not the appropriate one. I just want to know how to > delete sdh1 from raid, add a new partition and balance. > > My kernel version is: 3.8.0-31I''d upgrade the kernel to 3.10.14 or wait for some balance fixes to get into 3.11.x and the next 3.12 rc. Chris Murphy-- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Alfredo Esteban posted on Sun, 06 Oct 2013 13:10:49 +0200 as excerpted:> I''m getting an error when trying to delete a device from a raid1 (data > and metadata mirrored). > >> btrfs filesystem show > failed to read /dev/sr0 > Label: none uuid: 78b5162b-489e-4de1-a989-a47b91adef50 > Total devices 2 FS bytes used 107.64GB > devid 2 size 149.05GB used 109.01GB path /dev/sdh1 > devid 1 size 156.81GB used 109.03GB path /dev/sdb6 > > Btrfs v0.20-rc1 > >> btrfs device delete /dev/sdh1 /mnt/raid-data/ > ERROR: error removing the device ''/dev/sdh1'' - Inappropriate ioctl for > device > > Raid has been working fine for a long time. Both devices are present but > /dev/sdh1 is a new empty btrfs partition at the moment. > > I should like to know whether this is an error or "btrfs device delete" > command is not the appropriate one. I just want to know how to delete > sdh1 from raid, add a new partition and balance. > > My kernel version is: 3.8.0-31Two points in addition to what Chris Murphy said... 1) Btrfs still has the experimental label and is still under heavy development. Those choosing to run it are volunteering to test it as such. As an experimental filesystem under heavy development, each new kernel brings fixes as well as new features, and running a current kernel is *STRONGLY* recommended, both because it''ll have more bugs fixed, AND because if/when there IS a problem, the output and logs generated are going to be far more valuable if the kernel is current than if it''s several kernels behind. And several kernels behind is EXACTLY what 3.8 is. The current stable kernel is 3.11.4, with 3.12-rc3 just out as well. Why are you still back on 3.8? Do you WANT trouble from already fixed bugs, and output that''s not as valuable to the devs as that of a current kernel? As a btrfs tester you should be no farther back then second stable series AT THE OLDEST (so 3.10 series, presently), and even that is old and of limited value. Preferred is the latest stable series (3.11 at this point) or the development kernel (3.12-rc*). Note that there are reasons people might be a bit conservative and want to run old kernels, but those reasons don''t fit very well with being a tester of an experimental status filesystem such as btrfs. If you have reason to be conservative and run and old kernel, and you might, you really should reconsider whether testing btrfs is appropriate for you or not, since running an experimental status filesystem is anything BUT conservative. 2) Btrfs raid modes won''t allow you to reduce the number of devices below the minimum number necessary for undegraded use of that raid mode. So raid1 and raid0 modes require two devices minimum, raid10 and the new raid6 modes require four devices minimum, and raid5 requires three minimum. (Note that raid5/6 aren''t considered ready for ordinary use yet.) Since your btrfs in raid1 mode has two devices currently, you won''t be able to delete one of them as-is. You will need to ADD a device first (bringing the total to three devices), optionally do a balance, and THEN delete the failed/missing/to-be-removed device (bringing the total back to two, which you never go below that way). This, among other things, is covered on the btrfs wiki. If you''ve not read it recently, you''re probably missing other useful hints and information that it covers too, and I''d recommend spending some time reading it. https://btrfs.wiki.kernel.org -- Duncan - List replies preferred. No HTML msgs. "Every nonfree program has a lord, a master -- and if you use the program, he is your master." Richard Stallman -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Oct 7, 2013, at 4:38 AM, Duncan <1i5t5.duncan@cox.net> wrote:> Since your btrfs in raid1 mode has two devices currently, you won''t be > able to delete one of them as-is. You will need to ADD a device first > (bringing the total to three devices), optionally do a balance, and THEN > delete the failed/missing/to-be-removed device (bringing the total back > to two, which you never go below that way).Oops that''s right, I forgot about this, and I have read the wiki! The other way to do it is to just pull the device, preferably with the file system unmounted. And then use it in degraded mode. I don''t know if it''s possible to convert a degraded volume, however. Chris Murphy -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Oct 7, 2013, at 9:44 AM, Chris Murphy <lists@colorremedies.com> wrote:> > On Oct 7, 2013, at 4:38 AM, Duncan <1i5t5.duncan@cox.net> wrote: > >> Since your btrfs in raid1 mode has two devices currently, you won''t be >> able to delete one of them as-is. You will need to ADD a device first >> (bringing the total to three devices), optionally do a balance, and THEN >> delete the failed/missing/to-be-removed device (bringing the total back >> to two, which you never go below that way). > > Oops that''s right, I forgot about this, and I have read the wiki! The other way to do it is to just pull the device, preferably with the file system unmounted. And then use it in degraded mode. I don''t know if it''s possible to convert a degraded volume, however.Jeez, do I write much? Disconnect the device you want removed from the volume. Mount the one you want to keep using with -o degraded. Chris Murphy-- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Thank a lot for your responses. I already knew degraded mount but I wanted to solve the problem in a consistent way and not continuing to mount in degraded mode. I tried to add another device and "btrfs device delete missing /mnt" but it failed. I also tried using balance filters and --force option as Timofei pointed out but it failed too. So finally I upgraded my kernel to 3.11, generated new raid1 filesystem on devices and copied data back to it. Thanks again, Alfredo 2013/10/7 Chris Murphy <lists@colorremedies.com>:> > On Oct 7, 2013, at 9:44 AM, Chris Murphy <lists@colorremedies.com> wrote: > >> >> On Oct 7, 2013, at 4:38 AM, Duncan <1i5t5.duncan@cox.net> wrote: >> >>> Since your btrfs in raid1 mode has two devices currently, you won''t be >>> able to delete one of them as-is. You will need to ADD a device first >>> (bringing the total to three devices), optionally do a balance, and THEN >>> delete the failed/missing/to-be-removed device (bringing the total back >>> to two, which you never go below that way). >> >> Oops that''s right, I forgot about this, and I have read the wiki! The other way to do it is to just pull the device, preferably with the file system unmounted. And then use it in degraded mode. I don''t know if it''s possible to convert a degraded volume, however. > > Jeez, do I write much? Disconnect the device you want removed from the volume. Mount the one you want to keep using with -o degraded. > > Chris Murphy-- > To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html-- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Reasonably Related Threads
- Help interpreting RAID1 space allocation
- btrfs scrub BUG: unable to handle kernel NULL pointer dereference
- Can't replace a faulty disk of raid1
- Remove a materially failed device from a Btrfs "single-raid" using partitions
- Can't remove empty directory after kernel panic, no errors in dmesg