Hi,
how to suggest improvements to the Wiki, like ZFS::Changing a failed device? If I see correctly, the Admin Manual references to the Wiki and there the infos are very brief. In particular I think it could happen that users could replace to something like /dev/sdx which is not recommended.
I suggest to add some guide how to find the ID. I used a combination of dmesg, fdisk -l and ls -l /dev/disk/by-id/|grep sdX. Probably there is a more elegant way, but by this I successfully replaced a device and ZFS automatically partitioned the disk (with the 8 MB safetey margin).
In detail:
Now replace the disk and find how it is called. When using hotplug, dmesg should show a very recent new disk device like
When the disk was replaced before a reboot, /var/log/kern.log contains the names among all others. Be careful not to mix it up.
To get futher information, also fdisk -l, gdisk -l, sfdisk -l and sgdisk -l can be helpful, others suggest lsblk.
It is recommended not to use this possibly dynamic device name, but instead a fixed one, preferably the linux disk ID. A simple way to find it for /dev/sda could be
Finally, replace it, wait a few seconds and query a status. Assuming the pool would be called dpool, it could be:
how to suggest improvements to the Wiki, like ZFS::Changing a failed device? If I see correctly, the Admin Manual references to the Wiki and there the infos are very brief. In particular I think it could happen that users could replace to something like /dev/sdx which is not recommended.
I suggest to add some guide how to find the ID. I used a combination of dmesg, fdisk -l and ls -l /dev/disk/by-id/|grep sdX. Probably there is a more elegant way, but by this I successfully replaced a device and ZFS automatically partitioned the disk (with the 8 MB safetey margin).
In detail:
Changing a failed device
First look up the failed device using a command line "zpool status". The bad disk should be marked as "FAULTED". Remember the device name (e.g. "ata-TOSHIBA_MG04ACA400E_1234567800").Now replace the disk and find how it is called. When using hotplug, dmesg should show a very recent new disk device like
Bash:
root@pve:~# dmesg
[1234.943372] ata5.00: ATA-8: TOSHIBA MG04ACA400E, FP4B, max UDMA/100
[1234.943898] ata5.00: 7814037168 sectors, multi 16: LBA48 NCQ (depth 32), AA
[1234.945993] ata5.00: configured for UDMA/100
[1234.946136] scsi 4:0:0:0: Direct-Access ATA TOSHIBA MG04ACA4 FP4B PQ: 0 ANSI: 5
[1234.946284] sd 4:0:0:0: Attached scsi generic sg0 type 0
[1234.946581] sd 4:0:0:0: [sda] 7814037168 512-byte logical blocks: (4.00 TB/3.64 TiB)
[1234.946585] sd 4:0:0:0: [sda] 4096-byte physical blocks
When the disk was replaced before a reboot, /var/log/kern.log contains the names among all others. Be careful not to mix it up.
To get futher information, also fdisk -l, gdisk -l, sfdisk -l and sgdisk -l can be helpful, others suggest lsblk.
It is recommended not to use this possibly dynamic device name, but instead a fixed one, preferably the linux disk ID. A simple way to find it for /dev/sda could be
Bash:
root@pve:~# ls -l /dev/disk/by-id/|grep sda
lrwxrwxrwx 1 root root 9 Nov 9 15:10 ata-TOSHIBA_MG04ACA400E_1234567801 -> ../../sda
Finally, replace it, wait a few seconds and query a status. Assuming the pool would be called dpool, it could be:
Bash:
root@pve:~# zpool replace dpool ata-TOSHIBA_MG04ACA400E_1234567800 ata-TOSHIBA_MG04ACA400E_1234567801
root@pve:~# zpool status dpool