Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##########################################
- #PREPARE files:
- #Creating 5 files representing the disks, then expanding the files to 1G in size.
- konstantin@majestix:/tmp/zpool-experiment$ touch disk1 disk2 disk3 disk4 disk5
- konstantin@majestix:/tmp/zpool-experiment$ dd if=/dev/zero bs=1G count=1 of=disk1
- 1+0 records in
- 1+0 records out
- 1073741824 bytes (1,1 GB, 1,0 GiB) copied, 2,36143 s, 455 MB/s
- konstantin@majestix:/tmp/zpool-experiment$ dd if=/dev/zero bs=1G count=1 of=disk2
- 1+0 records in
- 1+0 records out
- 1073741824 bytes (1,1 GB, 1,0 GiB) copied, 2,35572 s, 456 MB/s
- konstantin@majestix:/tmp/zpool-experiment$ dd if=/dev/zero bs=1G count=1 of=disk3
- 1+0 records in
- 1+0 records out
- 1073741824 bytes (1,1 GB, 1,0 GiB) copied, 2,36414 s, 454 MB/s
- konstantin@majestix:/tmp/zpool-experiment$ dd if=/dev/zero bs=1G count=1 of=disk4
- 1+0 records in
- 1+0 records out
- 1073741824 bytes (1,1 GB, 1,0 GiB) copied, 2,36307 s, 454 MB/s
- konstantin@majestix:/tmp/zpool-experiment$ dd if=/dev/zero bs=1G count=1 of=disk5
- 1+0 records in
- 1+0 records out
- 1073741824 bytes (1,1 GB, 1,0 GiB) copied, 2,39869 s, 448 MB/s
- konstantin@majestix:/tmp/zpool-experiment$
- ##########################################
- #CREATE zpool:
- #Create a zpool as a raidz1 from the files. NOTE: I'm working with files instead of actual disk devices, this is why I have to use the "-d /path/to/file" option.
- konstantin@majestix:/tmp/zpool-experiment$ sudo zpool create EXPERIMENTAL raidz /tmp/zpool-experiment/disk1 /tmp/zpool-experiment/disk2 /tmp/zpool-experiment/disk3 /tmp/zpool-experiment/disk4 /tmp/zpool-experiment/disk5
- konstantin@majestix:/tmp/zpool-experiment$
- konstantin@majestix:/tmp/zpool-experiment$ zpool status EXPERIMENTAL
- pool: EXPERIMENTAL
- state: ONLINE
- scan: none requested
- config:
- NAME STATE READ WRITE CKSUM
- EXPERIMENTAL ONLINE 0 0 0
- raidz1-0 ONLINE 0 0 0
- /tmp/zpool-experiment/disk1 ONLINE 0 0 0
- /tmp/zpool-experiment/disk2 ONLINE 0 0 0
- /tmp/zpool-experiment/disk3 ONLINE 0 0 0
- /tmp/zpool-experiment/disk4 ONLINE 0 0 0
- /tmp/zpool-experiment/disk5 ONLINE 0 0 0
- errors: No known data errors
- konstantin@majestix:/tmp/zpool-experiment$
- ##########################################
- #OFFLINE one disk:
- #The disk (disk1) with the SMART errors was offlined manually
- konstantin@majestix:/tmp/zpool-experiment$ sudo zpool offline EXPERIMENTAL /tmp/zpool-experiment/disk1
- konstantin@majestix:/tmp/zpool-experiment$
- konstantin@majestix:/tmp/zpool-experiment$ zpool status EXPERIMENTAL
- pool: EXPERIMENTAL
- state: DEGRADED
- status: One or more devices has been taken offline by the administrator.
- Sufficient replicas exist for the pool to continue functioning in a
- degraded state.
- action: Online the device using 'zpool online' or replace the device with
- 'zpool replace'.
- scan: none requested
- config:
- NAME STATE READ WRITE CKSUM
- EXPERIMENTAL DEGRADED 0 0 0
- raidz1-0 DEGRADED 0 0 0
- /tmp/zpool-experiment/disk1 OFFLINE 0 0 0
- /tmp/zpool-experiment/disk2 ONLINE 0 0 0
- /tmp/zpool-experiment/disk3 ONLINE 0 0 0
- /tmp/zpool-experiment/disk4 ONLINE 0 0 0
- /tmp/zpool-experiment/disk5 ONLINE 0 0 0
- errors: No known data errors
- konstantin@majestix:/tmp/zpool-experiment$
- ##########################################
- #EXPORT zpool and disconnect another disk:
- #The system was powered off (a zpool export usually happens) and the wrong disk (disk2) was physically disconnected. On the next reboot a zpool import is attempted but too many disks are missing in the zpool and the poo can't be imported.
- konstantin@majestix:/tmp/zpool-experiment$ sudo zpool export EXPERIMENTAL
- konstantin@majestix:/tmp/zpool-experiment$
- konstantin@majestix:/tmp/zpool-experiment$ mv disk2 disk2_unplugged
- konstantin@majestix:/tmp/zpool-experiment$
- konstantin@majestix:/tmp/zpool-experiment$ sudo zpool import -d /tmp/zpool-experiment/disk3
- pool: EXPERIMENTAL
- id: 17039649167381576158
- state: UNAVAIL
- status: One or more devices are missing from the system.
- action: The pool cannot be imported. Attach the missing
- devices and try again.
- see: http://zfsonlinux.org/msg/ZFS-8000-3C
- config:
- EXPERIMENTAL UNAVAIL insufficient replicas
- raidz1-0 UNAVAIL insufficient replicas
- /tmp/zpool-experiment/disk1 OFFLINE
- /tmp/zpool-experiment/disk2 UNAVAIL cannot open
- /tmp/zpool-experiment/disk3 ONLINE
- /tmp/zpool-experiment/disk4 ONLINE
- /tmp/zpool-experiment/disk5 ONLINE
- konstantin@majestix:/tmp/zpool-experiment$
- ##########################################
- #RECONNECT disk2 and try import again:
- #Power off the system, reconnect the accidentally pulled disk (disk2) and power on the system. It could be that the zpool is automatically imported, it could be that a manual import is necessary. NOTE: my zpool import command is missing the zpool name. This is why the import is not importing but only looking for the pool on the given disk/file.
- konstantin@majestix:/tmp/zpool-experiment$ sudo mv disk2_unplugged disk2
- konstantin@majestix:/tmp/zpool-experiment$
- konstantin@majestix:/tmp/zpool-experiment$ sudo zpool import -d /tmp/zpool-experiment/disk3
- pool: EXPERIMENTAL
- id: 17039649167381576158
- state: DEGRADED
- status: One or more devices are offlined.
- action: The pool can be imported despite missing or damaged devices. The
- fault tolerance of the pool may be compromised if imported.
- config:
- EXPERIMENTAL DEGRADED
- raidz1-0 DEGRADED
- /tmp/zpool-experiment/disk1 OFFLINE
- /tmp/zpool-experiment/disk2 ONLINE
- /tmp/zpool-experiment/disk3 ONLINE
- /tmp/zpool-experiment/disk4 ONLINE
- /tmp/zpool-experiment/disk5 ONLINE
- konstantin@majestix:/tmp/zpool-experiment$
- konstantin@majestix:/tmp/zpool-experiment$ sudo zpool import -d /tmp/zpool-experiment/disk3 EXPERIMENTAL
- konstantin@majestix:/tmp/zpool-experiment$
- konstantin@majestix:/tmp/zpool-experiment$ zpool status EXPERIMENTAL
- pool: EXPERIMENTAL
- state: DEGRADED
- status: One or more devices has been taken offline by the administrator.
- Sufficient replicas exist for the pool to continue functioning in a
- degraded state.
- action: Online the device using 'zpool online' or replace the device with
- 'zpool replace'.
- scan: none requested
- config:
- NAME STATE READ WRITE CKSUM
- EXPERIMENTAL DEGRADED 0 0 0
- raidz1-0 DEGRADED 0 0 0
- /tmp/zpool-experiment/disk1 OFFLINE 0 0 0
- /tmp/zpool-experiment/disk2 ONLINE 0 0 0
- /tmp/zpool-experiment/disk3 ONLINE 0 0 0
- /tmp/zpool-experiment/disk4 ONLINE 0 0 0
- /tmp/zpool-experiment/disk5 ONLINE 0 0 0
- errors: No known data errors
- konstantin@majestix:/tmp/zpool-experiment$
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement