# zpool data corruption



## daniel (Aug 17, 2011)

I can't boot in my system normally after some harddisk crash (ad6).
I can boot to single user mode where I can view the status of the pool:


```
# zpool status tank -v
   pool: tank
   state: DEGRADED
   status: One or more devices has experienced an error resulting in data
             corruption.  Applications may be affected.
   action: Restore the file in question if possible.  Otherwise restore the
             entire pool from backup.

        NAME            STATE     READ WRITE CKSUM
        tank            DEGRADED     0     0     0
          raidz2        DEGRADED     0     0     0
            ad4         ONLINE       0     0     0
            ad6         ONLINE       0     0     0
            ad8         ONLINE       0     0     0
            replacing   DEGRADED     0     0    62
              ad10/old  UNAVAIL      0 12.0K     0  cannot open
              ad10      ONLINE       0     0     0
            ad12        ONLINE       0     0     0
            replacing   DEGRADED     0     0     0
              ad14/old  UNAVAIL      0 11.6K     0  cannot open
              ad14      ONLINE       0     0     0

Permanent errors have been detected in the following files:
   //etc/login.conf.db
   //sbin
   //etc/localtime
   //etc/login.conf
   //etc/rc
```

Is there a way to repair these file errors?
Otherwisem, all other important data is still in the pool. 
What's the best way to save the data and recreate the pool while I am in single user mode? 
Thanks,
Daniel


----------



## phoenix (Aug 17, 2011)

Do you have any snapshots of the /etc/ and /sbin directories?  If you do, then you can copy those files out of the snapshot (say / is a on ZFS filesystem):

```
# cp -p /.zfs/snapshot/<snapshot-name>/etc/login.conf.db /etc/
# cp -p /.zfs/snapshot/<snapshot-name>/etc/localtime /etc/
# cp -p /.zfs/snapshot/<snapshot-name>/etc/login.conf /etc/
# rm -rf /sbin
# mkdir /sbin
# cp -p /.zfs/snapshot/<snapshot-name>/sbin/* /sbin/
```

If that doesn't help, then hopefully you have good backups.  

If not, then you can use rsync(8) or cp(1) or even zfs(1) send/recv to copy data off the pool to a separate harddrive and then destroy/recreate the pool and copy the data back.


----------



## Magneto (Aug 18, 2011)

a screenshot would help identifying the problem


----------



## daniel (Aug 18, 2011)

I am in single user mode, and remounted the fs / read-writable.
I can see the snapshots with *zfs list -t all*, but when I enter e.g. /.zfs/snapshot/ it appears empty.
As well all the home directories appear empty.
Is there any way to access the data in the pool? I want to copy all to another server.

Thanks, Daniel


----------



## phoenix (Aug 18, 2011)

Can you post the output of:
`# zpool status`
`# zfs list -t snapshot | tail -5`
`# zfs list`

That will help us to visualise how your system is setup, so that we can make accurate recommendations.


----------

