Hallo, cwillu,
Du meintest am 29.03.11:
>> I have a disk with a SMART failure. It still works but I assume
>> it'll fail sooner or later.
>>
>> I want to remove it from my btrfs volume, replace it, and add the
>> new one. But the obvious command doesn't work:
[...]
> There's no "nice" way to remove a failing disk in btrfs right now
> ("btrfs dev delete" is more of a online management thing to politely
> remove a perfectly functional disk you'd like to use for something
> else.)
Nice hope, but even "btrfs device delete /dev/sdxn /mnt/btr" doesn't
work well.
I've tried it, with kernel 2.6.38.1 ...
# mkfs.btrfs -L SCSI -m raid0 /dev/sda1
# mount LABEL=SCSI /mnt/btr
# btrfs filesystem show
Label: 'SCSI' uuid: 4d834705-5a65-4d1f-a8a0-a5ea9348db50
Total devices 1 FS bytes used 28.00KB
devid 1 size 4.04GB used 20.00MB path /dev/sda1
Btrfs Btrfs v0.19
# btrfs filesystem df /mnt/btr
Data: total=8.00MB, used=0.00
System: total=4.00MB, used=8.00KB
Metadata: total=8.00MB, used=20.00KB
# df -t btrfs
Filesystem Type 1K-blocks Used Available Use% Mounted on
/dev/sda1 btrfs 4232556 28 4220224 1% /mnt/btr
# gdisk -l
/dev/sda
1 2048 8467166 4.0 GiB 0700 Linux/Windows data
#------------------------------------------------------------
# btrfs device add /dev/sdc1 /mnt/btr
# btrfs filesystem show
Label: 'SCSI' uuid: 4d834705-5a65-4d1f-a8a0-a5ea9348db50
Total devices 2 FS bytes used 28.00KB
devid 1 size 4.04GB used 433.31MB path /dev/sda1
devid 2 size 8.54GB used 0.00 path /dev/sdc1
Btrfs Btrfs v0.19
# btrfs filesystem df /mnt/btr
Data: total=421.31MB, used=0.00
System: total=4.00MB, used=4.00KB
Metadata: total=8.00MB, used=24.00KB
# df -t btrfs
Filesystem Type 1K-blocks Used Available Use% Mounted on
/dev/sda1 btrfs 13189632 28 13176256 1% /mnt/btr
# gdisk -l
/dev/sda
1 2048 8467166 4.0 GiB 0700 Linux/Windows data
/dev/sdc
1 2048 17916206 8.5 GiB 0700 Linux/Windows data
#------------------------------------------------------------
# 2 GByte kopiert
# btrfs filesystem show
Label: 'SCSI' uuid: 4d834705-5a65-4d1f-a8a0-a5ea9348db50
Total devices 2 FS bytes used 2.10GB
devid 1 size 4.04GB used 433.31MB path /dev/sda1
devid 2 size 8.54GB used 2.25GB path /dev/sdc1
Btrfs Btrfs v0.19
# btrfs filesystem df /mnt/btr
Data: total=2.41GB, used=2.10GB
System: total=4.00MB, used=4.00KB
Metadata: total=264.00MB, used=2.79MB
# df -t btrfs
Filesystem Type 1K-blocks Used Available Use% Mounted on
/dev/sda1 btrfs 13189632 2202740 10714232 18% /mnt/btr
# gdisk -l
/dev/sda
1 2048 8467166 4.0 GiB 0700 Linux/Windows data
/dev/sdc
1 2048 17916206 8.5 GiB 0700 Linux/Windows data
#------------------------------------------------------------
# 7 GByte kopiert
# btrfs filesystem show
Label: 'SCSI' uuid: 4d834705-5a65-4d1f-a8a0-a5ea9348db50
Total devices 2 FS bytes used 9.03GB
devid 1 size 4.04GB used 1.42GB path /dev/sda1
devid 2 size 8.54GB used 8.25GB path /dev/sdc1
Btrfs Btrfs v0.19
# btrfs filesystem df /mnt/btr
Data: total=9.41GB, used=9.02GB
System: total=4.00MB, used=4.00KB
Metadata: total=264.00MB, used=11.80MB
# df -t btrfs
Filesystem Type 1K-blocks Used Available Use% Mounted on
/dev/sda1 btrfs 13189632 9467164 3459032 74% /mnt/btr
# gdisk -l
/dev/sda
1 2048 8467166 4.0 GiB 0700 Linux/Windows data
/dev/sdc
1 2048 17916206 8.5 GiB 0700 Linux/Windows data
#------------------------------------------------------------
# btrfs device add /dev/sdb1 /mnt/btr
# btrfs filesystem show
Label: 'SCSI' uuid: 4d834705-5a65-4d1f-a8a0-a5ea9348db50
Total devices 3 FS bytes used 9.12GB
devid 3 size 136.73GB used 0.00 path /dev/sdb1
devid 1 size 4.04GB used 1.42GB path /dev/sda1
devid 2 size 8.54GB used 8.25GB path /dev/sdc1
Btrfs Btrfs v0.19
# btrfs filesystem df /mnt/btr
Data: total=9.41GB, used=9.10GB
System: total=4.00MB, used=4.00KB
Metadata: total=264.00MB, used=11.91MB
# df -t btrfs
Filesystem Type 1K-blocks Used Available Use% Mounted on
/dev/sda1 btrfs 156562592 9559000 146739216 7% /mnt/btr
# gdisk -l
/dev/sda
1 2048 8467166 4.0 GiB 0700 Linux/Windows data
/dev/sdc
1 2048 17916206 8.5 GiB 0700 Linux/Windows data
/dev/sdb
1 2048 286747966 136.7 GiB 0700 Linux/Windows data
#------------------------------------------------------------
# btrfs filesystem balance /mnt/btr
# btrfs filesystem show
Label: 'SCSI' uuid: 4d834705-5a65-4d1f-a8a0-a5ea9348db50
Total devices 3 FS bytes used 9.11GB
devid 3 size 136.73GB used 10.61GB path /dev/sdb1
devid 1 size 4.04GB used 3.70GB path /dev/sda1
devid 2 size 8.54GB used 8.08GB path /dev/sdc1
Btrfs Btrfs v0.19
# btrfs filesystem df /mnt/btr
Data, RAID0: total=21.89GB, used=9.10GB
System: total=4.00MB, used=4.00KB
Metadata, RAID0: total=511.88MB, used=10.15MB
# df -t btrfs
Filesystem Type 1K-blocks Used Available Use% Mounted on
/dev/sda1 btrfs 156562592 9557196 14370128 40% /mnt/btr
# gdisk -l
/dev/sda
1 2048 8467166 4.0 GiB 0700 Linux/Windows data
/dev/sdc
1 2048 17916206 8.5 GiB 0700 Linux/Windows data
/dev/sdb
1 2048 286747966 136.7 GiB 0700 Linux/Windows data
#------------------------------------------------------------
# 8 GByte kopiert
# btrfs filesystem show
Label: 'SCSI' uuid: 4d834705-5a65-4d1f-a8a0-a5ea9348db50
Total devices 3 FS bytes used 17.02GB
devid 3 size 136.73GB used 10.61GB path /dev/sdb1
devid 1 size 4.04GB used 3.70GB path /dev/sda1
devid 2 size 8.54GB used 8.08GB path /dev/sdc1
Btrfs Btrfs v0.19
# btrfs filesystem df /mnt/btr
Data, RAID0: total=21.89GB, used=17.00GB
System: total=4.00MB, used=4.00KB
Metadata, RAID0: total=511.88MB, used=18.66MB
# df -t btrfs
Filesystem Type 1K-blocks Used Available Use% Mounted on
/dev/sda1 btrfs 156562592 17850436 6085608 75% /mnt/btr
# gdisk -l
/dev/sda
1 2048 8467166 4.0 GiB 0700 Linux/Windows data
/dev/sdc
1 2048 17916206 8.5 GiB 0700 Linux/Windows data
/dev/sdb
1 2048 286747966 136.7 GiB 0700 Linux/Windows data
#------------------------------------------------------------
# btrfs filesystem balance /mnt/btr
# btrfs filesystem show
Label: 'SCSI' uuid: 4d834705-5a65-4d1f-a8a0-a5ea9348db50
Total devices 3 FS bytes used 17.08GB
devid 3 size 136.73GB used 9.08GB path /dev/sdb1
devid 1 size 4.04GB used 2.09GB path /dev/sda1
devid 2 size 8.54GB used 8.08GB path /dev/sdc1
Btrfs Btrfs v0.19
# btrfs filesystem df /mnt/btr
Data, RAID0: total=19.00GB, used=17.06GB
System: total=4.00MB, used=4.00KB
Metadata, RAID0: total=255.94MB, used=18.51MB
# df -t btrfs
Filesystem Type 1K-blocks Used Available Use% Mounted on
/dev/sda1 btrfs 156562592 17911352 6118356 75% /mnt/btr
# gdisk -l
/dev/sda
1 2048 8467166 4.0 GiB 0700 Linux/Windows data
/dev/sdc
1 2048 17916206 8.5 GiB 0700 Linux/Windows data
/dev/sdb
1 2048 286747966 136.7 GiB 0700 Linux/Windows data
#------------------------------------------------------------
and then follows the problem I've told last year: "no space left on
device ...". In this special case: even not enough place for deleting
one partition.
Trying "btrfs device delete ..." without previous "balance" leads to
# btrfs device delete /dev/sdc1 /mnt/btr
# endet mit "error removing the device '/dev/sdc1'"
Viele Gruesse!
Helmut
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html