Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have this zpool:

    bash-3.2# zpool status dpool
  pool: dpool
 state: ONLINE
 scan: none requested
 config:
        NAME                                     STATE     READ WRITE CKSUM
        dpool                                    ONLINE       0     0     0
          c3t600601604F021A009E1F867A3E24E211d0  ONLINE       0     0     0
          c3t600601604F021A00141D843A3F24E211d0  ONLINE       0     0     0

I would like to replace both of these disks with a single (larger disk). Can it be done? zpool attach allows me to replace one physical disk, but it won't allow me to replace both at once.

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

No, I don't think this is possible in the manner you're describing.

You can, however, create a new pool with the single disk and copy your ZFS filesystems to the new pool using a simple zfs send/receive process.

share|improve this answer
    
I was hoping to avoid an outage, but looks like I'm out of luck, thanks! –  rmeden Nov 7 '12 at 18:35
add comment

You should be able to zpool attach the new and larger drive, wait for the mirroring to be completed, and then zpool detach the old drives.

Edit: I had misread your question, and I was quite sure that you were running them as a mirror.

I agree that the best course of action is to create a new pool and recursively send all datasets to the new pool, but if you really cannot do that, then you could still follow the steps I'm outlining, provided that you partition the new, larger disk, into two partitions, each as least as large as the disk that it is meant to replace.

I recommend against this, mainly because (1) management becomes more complex, and (2) you won't be able to take advantage of the drive's write cache.

I'll paste here the sequence as performed on a recent Illumos box. Please note that I'm creating empty files to show this, instead of using whole disks and slices/partitions, as I can't juggle physical devices on that box. The files are named aa1, aa2 and aa3.

  1. Prepare the devices. aa3 is 200M large, while aa1 and aa2 are 100M only:

    # dd if=/dev/zero of=/opt/local/aa1 bs=1M count=100
    # dd if=/dev/zero of=/opt/local/aa2 bs=1M count=100
    # dd if=/dev/zero of=/opt/local/aa3 bs=1M count=200
    
  2. Create our test pool:

    # zpool create test mirror /opt/local/aa1 /opt/local/aa2
    

    Check that everything went smoothly:

    # zpool list -v test
    NAME                 SIZE  ALLOC   FREE  EXPANDSZ    CAP  DEDUP  HEALTH  ALTROOT
    test                95,5M   106K  95,4M         -     0%  1.00x  ONLINE  -
      mirror            95,5M   106K  95,4M         -
        /opt/local/aa1      -      -      -         -
        /opt/local/aa2      -      -      -         -
    
  3. Set the autoexpand property:

    # zpool set autoexpand=on test
    
  4. Attach the new device:

    # zpool attach test /opt/local/aa2 /opt/local/aa3
    

    Is everything still fine?

    # zpool list -v test
    NAME                 SIZE  ALLOC   FREE  EXPANDSZ    CAP  DEDUP  HEALTH  ALTROOT
    test                95,5M   120K  95,4M         -     0%  1.00x  ONLINE  -
      mirror            95,5M   120K  95,4M         -
        /opt/local/aa1      -      -      -         -
        /opt/local/aa2      -      -      -         -
        /opt/local/aa3      -      -      -         -
    

    Yes, it is.

  5. Detach the first two devs:

    # zpool detach test /opt/local/aa1
    # zpool detach test /opt/local/aa2
    

Finally, let's check the pool again:

# zpool list -v test
NAME               SIZE  ALLOC   FREE  EXPANDSZ    CAP  DEDUP  HEALTH  ALTROOT
test               196M   124K   195M         -     0%  1.00x  ONLINE  -
  /opt/local/aa3   196M   124K   195M         -

It has correctly grown to 200MB.

share|improve this answer
1  
-1 Sorry, he's looking to go from 2 disks to 1; your directions would work for 2->2 only. –  Chris S Nov 7 '12 at 15:53
    
I'm triple-checking it. –  pino42 Nov 7 '12 at 16:13
    
@ChrisS: please look at my edited answer. Do you think I misinterpreted rmeden's question? –  pino42 Nov 7 '12 at 16:28
    
You replaced a mirror with a single disk... Definitely not the same as what he's asking. –  Chris S Nov 7 '12 at 17:07
    
You are right, my bad. I edited my answer, along with a recommendation against the same course of action that I am proposing. –  pino42 Nov 7 '12 at 17:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.