11

My Ubuntu 12.04 system has two zpools: rpool (containing the root filesystem) and rdata (containing all other data). rdata was originally 2 x 1TB disks mirrored.

Because I couldn't upgrade rdata to 3TB disks (wrong ashift) I had to create a new zpool from the new 3TB disks: initially called datapool. I then rsync'd all the data across, exported rdata, imported datapool as rdata and Bob's your Uncle. I then powered off and removed the old disks. However...

When I powered back on, zpool status shows

  pool: rdata
 state: UNAVAIL
status: One or more devices could not be used because the label is missing 
    or invalid.  There are insufficient replicas for the pool to continue
functioning.
action: Destroy and re-create the pool from
    a backup source.
   see: http://zfsonlinux.org/msg/ZFS-8000-5E
  scan: none requested
config:

NAME                                                 STATE     READ WRITE CKSUM
rdata                                                UNAVAIL      0     0     0         insufficient replicas
  mirror-0                                           UNAVAIL      0     0     0  insufficient replicas
    scsi-SATA_WDC_WD10EADS-00_WD-WCAU47275172-part1  UNAVAIL      0     0     0
    scsi-SATA_WDC_WD10EADS-00_WD-WCAU47283913-part1  UNAVAIL      0     0     0

  pool: rpool
 state: ONLINE
  scan: scrub repaired 0 in 0h23m with 0 errors on Tue Jun  4 11:33:29 2013
config:

NAME                                 STATE     READ WRITE CKSUM
rpool                                ONLINE       0     0     0
  ata-Maxtor_6Y120L0_Y31J3CLE-part2  ONLINE       0     0     0

errors: No known data errors

As you can see, zpool status is still showing the old rdata; which is not available.

zpool import shows

   pool: rdata
     id: 7033445233439275442
  state: ONLINE
 action: The pool can be imported using its name or numeric identifier.
 config:

rdata                                   ONLINE
  mirror-0                              ONLINE
    scsi-SATA_ST3000DM001-1CH_W1F1EE1G  ONLINE
    scsi-SATA_ST3000DM001-1CH_W1F25SE2  ONLINE

This is the correct rdata

Question: How do I get Ubuntu to forget all about the old zpool?

Bruno Pereira
  • 73,643
Gareth
  • 163
  • 1
  • 2
  • 6

2 Answers2

11
sudo zpool destroy rdata

will destroy the old pool (you may need -f to force).

sudo zpool export rdata

will disconnect the pool.

sudo zpool import 7033445233439275442

will import the new pool. You need to use the id number as there are two "rdata" pools.

As you're running with a ZFS root, all that's left to do is rebuild the initramfs to update the pools:

sudo update-initramfs -c -k all
sudo update-grub

Reboot and all is well. :)

Jonathon
  • 2,481
  • Sorry, that made no difference. I tried a zpool destroy and it completed OK. I then rebooted and the old rdata pool was back in position.

    I'd already tried a zpool export to no effect

    – Gareth Jun 06 '13 at 14:40
  • It may be importing the old zpool rather than the new one when it boots due to having two pools with the same name.

    You could try importing the new one by its id with a different pool name (sudo zpool import 7033445233439275442 newdata), exporting the old one, then exporting and importing the new one again.

    – Jonathon Jun 06 '13 at 14:59
  • You know, I really though that might work, but no. It's the same. I'll try a reboot between the export and import – Gareth Jun 06 '13 at 15:06
  • Nope, no change. Where on earth is it finding the info about the old pool? There's nothing in /etc/zfs/zpool.cache – Gareth Jun 06 '13 at 15:11
  • Wait a second... you're running with a ZFS root. That means the initramfs will be built with information about the current pools. You'll need to do a 'sudo update-initramfs -c -k all' and 'sudo update-grub' before rebooting to rebuild it. – Jonathon Jun 06 '13 at 15:20
  • Ooh, good catch! I'll try that and report back. In the meantime I've reposted the question over on ServerFault to get a wider exposure. – Gareth Jun 06 '13 at 15:26
  • 2
    Jonathan, you are a star! – Gareth Jun 06 '13 at 15:39
  • Excellent! Glad I could help! – Jonathon Jun 06 '13 at 22:41
-2

You can destroy pool within just a command.

sudo zpool destroy <poolname>

Check the status of pool

sudo zpool status <poolname>
KK Patel
  • 19,083