Skip to content

Instantly share code, notes, and snippets.

@prateekpandey14
Last active February 27, 2020 20:31
Show Gist options
  • Select an option

  • Save prateekpandey14/f2a30b3f246fd5b44fdfb545185f78b4 to your computer and use it in GitHub Desktop.

Select an option

Save prateekpandey14/f2a30b3f246fd5b44fdfb545185f78b4 to your computer and use it in GitHub Desktop.

Revisions

  1. prateekpandey14 revised this gist Apr 24, 2019. 1 changed file with 10 additions and 31 deletions.
    41 changes: 10 additions & 31 deletions resize-single-disk-pool.md
    Original file line number Diff line number Diff line change
    @@ -22,26 +22,13 @@ cstor-5be1d388-60d3-11e9-8e67-42010aa00fcf 9.94G 220K 9.94G - 0%
    $ zpool set autoexpand=on cstor-5be1d388-60d3-11e9-8e67-42010aa00fcf`
    ```

    ### 4. Resize the disk use by the pool and restart the NDM pods schedeuled on same node
    ### 4. Resize the disk used by the pool
    If this is done already, that's fine.
    For a example purpose, have changed the disk size from 10GB to 20 GB. After restart make sure NDM pod comes in `Running` state.

    ### 5. Use command `parted -l` to lists partition layout on all block devices. after this command, type `Fix` at prompt to use new available space.
    ### 5. Get the expanded device name that is in-use with pool using `fdisk -l` command and use `parted /dev/<device-name>` to lists partition layout on device. Just after this command, type `Fix` at prompt to use new available space.
    ```sh
    $ parted -l
    Model: Google PersistentDisk (scsi)
    Disk /dev/sda: 107GB
    Sector size (logical/physical): 512B/4096B
    Partition Table: gpt
    Disk Flags:
    Number Start End Size File system Name Flags
    14 1049kB 5243kB 4194kB bios_grub
    15 5243kB 116MB 111MB fat32 boot, esp
    1 116MB 107GB 107GB ext4
    $ parted /dev/sdb print
    Warning: Not all of the space available to /dev/sdb appears to be used, you can
    fix the GPT to use all of the space (an extra 20971520 blocks) or continue with
    @@ -75,22 +62,10 @@ sh: 1: udevadm: not found
    Information: You may need to update /etc/fstab.
    ```
    ### 8. Check the parted size again using `parted -l`
    ### 8. Check the parted size again using `parted /dev/<device-name> print`
    ```sh
    $ parted -l
    Model: Google PersistentDisk (scsi)
    Disk /dev/sda: 107GB
    Sector size (logical/physical): 512B/4096B
    Partition Table: gpt
    Disk Flags:
    Number Start End Size File system Name Flags
    14 1049kB 5243kB 4194kB bios_grub
    15 5243kB 116MB 111MB fat32 boot, esp
    1 116MB 107GB 107GB ext4
    $ parted /dev/sdb print
    Model: Google PersistentDisk (scsi)
    Disk /dev/sdb: 21.5GB
    @@ -110,3 +85,7 @@ Note: Replace the disk name below by get disk name using `zpool status` command.
    zpool online -e cstor-5be1d388-60d3-11e9-8e67-42010aa00fcf /dev/disk/by-id/scsi-0Google_PersistentDisk_pdisk2
    ```
    ### 10. Restart the NDM pods schedeuled on same node with pool to reflect the updated size in `Disk` customresource
    After restart make sure NDM pod comes in `Running` state.
  2. prateekpandey14 revised this gist Apr 19, 2019. 1 changed file with 29 additions and 14 deletions.
    43 changes: 29 additions & 14 deletions resize-single-disk-pool.md
    Original file line number Diff line number Diff line change
    @@ -1,24 +1,35 @@
    ## 1. Do kubectl exec inside the cstor-pool-mgmt using command and install `parted` using `apt-get install parted`
    ### 1. Do kubectl exec inside the cstor-pool-mgmt using command and install `parted`

    Get the pool pod name using `kubectl get pods -n openebs` command and exec inside
    the container. Install the `parted` tool using `apt-get install parted` after execing into the
    `cstor-pool-mgmt` container.

    ```sh
    $ kubectl exec -it cstor-pool-1fth-7fbbdfc747-sh25t -n openebs -c cstor-pool-mgmt bash
    ```
    ## 2. zpool list (get the pool name)

    ### 2. zpool list (get the pool name)

    ```sh
    $ zpool list
    NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
    cstor-5be1d388-60d3-11e9-8e67-42010aa00fcf 9.94G 220K 9.94G - 0% 0% 1.00x ONLINE -
    ```

    ## 3. Set your zpool with `autoextend on` (it defaults to off)
    ### 3. Set your zpool with `autoextend on` (it defaults to off)

    ```sh
    $ zpool set autoexpand=on cstor-5be1d388-60d3-11e9-8e67-42010aa00fcf`
    ```
    ## 4. Resize the disk related to the above pool and restart the NDM pods scheduled in same node as pool.
    Just for testing purpose, i have changed the disk size from 10GB to 20 GB

    ## 5. Use command `parted -l` to lists partition layout on all block devices. after this command, type ‘Fix’ at prompt to use new availble space.
    ### 4. Resize the disk use by the pool and restart the NDM pods schedeuled on same node

    For a example purpose, have changed the disk size from 10GB to 20 GB. After restart make sure NDM pod comes in `Running` state.

    ### 5. Use command `parted -l` to lists partition layout on all block devices. after this command, type `Fix` at prompt to use new available space.

    ```sh
    $ parted -l
    $ parted -l
    Model: Google PersistentDisk (scsi)
    Disk /dev/sda: 107GB
    @@ -47,23 +58,26 @@ Number Start End Size File system Name Flags
    9 10.7GB 10.7GB 8389kB
    ```
    ---------------------------------------------------------------------------------------

    ## 6. Remove the buffering partition
    ### 6. Remove the buffering partition

    ```sh
    parted /dev/sdb rm 9
    ```

    ## 7. Expand partition holding zpool
    ### 7. Expand partition holding zpool

    ```sh
    $ parted /dev/sdb resizepart 1 100%
    sh: 1: udevadm: not found
    sh: 1: udevadm: not found
    Information: You may need to update /etc/fstab.
    ```
    ## 8. Check the parted size again using `parted -l`
    ```

    ### 8. Check the parted size again using `parted -l`

    ```sh
    $ parted -l
    Model: Google PersistentDisk (scsi)
    @@ -88,10 +102,11 @@ Number Start End Size File system Name Flags
    1 1049kB 21.5GB 21.5GB zfs zfs-d97901ec3aa0fb69
    ```

    ## 9. Size is changed from 10GB to 20GB, Now we have to tell the zpool to bring specified physical device online using following command.
    ### 9. Size is changed from 10GB to 20GB, Now we have to tell the zpool to bring specified physical device online using following command.

    Note: Replace the disk name below by get disk name using `zpool status` command.

    ```sh
    zpool online -e cstor-5be1d388-60d3-11e9-8e67-42010aa00fcf /dev/disk/by-id/scsi-0Google_PersistentDisk_pdisk2
    ```
    ```
  3. prateekpandey14 revised this gist Apr 17, 2019. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions resize-single-disk-pool.md
    Original file line number Diff line number Diff line change
    @@ -13,8 +13,8 @@ cstor-5be1d388-60d3-11e9-8e67-42010aa00fcf 9.94G 220K 9.94G - 0%
    ```sh
    $ zpool set autoexpand=on cstor-5be1d388-60d3-11e9-8e67-42010aa00fcf`
    ```
    ## 4. Resize the disk related to the above pool and restart the NDM pods on that node.(use other terminal)
    For just for testing, changed the disk size from 10GB to 20 GB
    ## 4. Resize the disk related to the above pool and restart the NDM pods scheduled in same node as pool.
    Just for testing purpose, i have changed the disk size from 10GB to 20 GB

    ## 5. Use command `parted -l` to lists partition layout on all block devices. after this command, type ‘Fix’ at prompt to use new availble space.
    ```sh
  4. prateekpandey14 revised this gist Apr 17, 2019. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions resize-single-disk-pool.md
    Original file line number Diff line number Diff line change
    @@ -88,8 +88,9 @@ Number Start End Size File system Name Flags
    1 1049kB 21.5GB 21.5GB zfs zfs-d97901ec3aa0fb69
    ```
    ## 9. Size is changed from 10GB to 20GB, Now we have to tell the zpool brings the specified physical device online using following command.
    Replace the disk name below by get disk name using `zpool status` command
    ## 9. Size is changed from 10GB to 20GB, Now we have to tell the zpool to bring specified physical device online using following command.
    Note: Replace the disk name below by get disk name using `zpool status` command.
    ```sh
    zpool online -e cstor-5be1d388-60d3-11e9-8e67-42010aa00fcf /dev/disk/by-id/scsi-0Google_PersistentDisk_pdisk2
  5. prateekpandey14 revised this gist Apr 17, 2019. 1 changed file with 10 additions and 9 deletions.
    19 changes: 10 additions & 9 deletions resize-single-disk-pool.md
    Original file line number Diff line number Diff line change
    @@ -1,23 +1,22 @@
    ## 1. Do kubectl exec inside the cstor-pool-mgmt using command and install `parted` using `apt-get install parted`
    ```sh
    kubectl exec -it cstor-pool-1fth-7fbbdfc747-sh25t -n openebs -c cstor-pool-mgmt bash
    $ kubectl exec -it cstor-pool-1fth-7fbbdfc747-sh25t -n openebs -c cstor-pool-mgmt bash
    ```
    ## 2. zpool list (get the pool name)
    ```sh
    zpool list
    $ zpool list
    NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
    cstor-5be1d388-60d3-11e9-8e67-42010aa00fcf 9.94G 220K 9.94G - 0% 0% 1.00x ONLINE -
    ```

    ## 3. Set your zpool with `autoextend on` (it defaults to off)
    ```sh
    zpool set autoexpand=on cstor-5be1d388-60d3-11e9-8e67-42010aa00fcf`
    $ zpool set autoexpand=on cstor-5be1d388-60d3-11e9-8e67-42010aa00fcf`
    ```
    ## 4. Resize the disk related to the above pool and restart the NDM pods on that node.(use other terminal)
    For just for testing, changed the disk size from 10GB to 20 GB

    ## 5. Use command `parted -l` to lists partition layout on all block devices. after this command, type ‘Fix’ at prompt to take advantage
    of new space.
    ## 5. Use command `parted -l` to lists partition layout on all block devices. after this command, type ‘Fix’ at prompt to use new availble space.
    ```sh
    $ parted -l
    @@ -56,15 +55,17 @@ parted /dev/sdb rm 9
    ```

    ## 7. Expand partition holding zpool
    parted /dev/sdb resizepart 1 100%
    ```
    ```sh
    $ parted /dev/sdb resizepart 1 100%
    sh: 1: udevadm: not found
    sh: 1: udevadm: not found
    Information: You may need to update /etc/fstab.
    ```
    ## 8. Check the parted size again
    ## 8. Check the parted size again using `parted -l`
    ```
    root@cstor-pool-1fth-7fbbdfc747-sh25t:/# parted -l
    $ parted -l

    Model: Google PersistentDisk (scsi)
    Disk /dev/sda: 107GB
    Sector size (logical/physical): 512B/4096B
  6. prateekpandey14 revised this gist Apr 17, 2019. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion resize-single-disk-pool.md
    Original file line number Diff line number Diff line change
    @@ -87,7 +87,8 @@ Number Start End Size File system Name Flags
    1 1049kB 21.5GB 21.5GB zfs zfs-d97901ec3aa0fb69
    ```
    ## 9. Size is changed from 10GB to 20GB, Now we have to tell the zpool to expand/online using following command.
    ## 9. Size is changed from 10GB to 20GB, Now we have to tell the zpool brings the specified physical device online using following command.
    Replace the disk name below by get disk name using `zpool status` command
    ```sh
    zpool online -e cstor-5be1d388-60d3-11e9-8e67-42010aa00fcf /dev/disk/by-id/scsi-0Google_PersistentDisk_pdisk2
  7. prateekpandey14 created this gist Apr 17, 2019.
    94 changes: 94 additions & 0 deletions resize-single-disk-pool.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,94 @@
    ## 1. Do kubectl exec inside the cstor-pool-mgmt using command and install `parted` using `apt-get install parted`
    ```sh
    kubectl exec -it cstor-pool-1fth-7fbbdfc747-sh25t -n openebs -c cstor-pool-mgmt bash
    ```
    ## 2. zpool list (get the pool name)
    ```sh
    zpool list
    NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
    cstor-5be1d388-60d3-11e9-8e67-42010aa00fcf 9.94G 220K 9.94G - 0% 0% 1.00x ONLINE -
    ```

    ## 3. Set your zpool with `autoextend on` (it defaults to off)
    ```sh
    zpool set autoexpand=on cstor-5be1d388-60d3-11e9-8e67-42010aa00fcf`
    ```
    ## 4. Resize the disk related to the above pool and restart the NDM pods on that node.(use other terminal)
    For just for testing, changed the disk size from 10GB to 20 GB

    ## 5. Use command `parted -l` to lists partition layout on all block devices. after this command, type ‘Fix’ at prompt to take advantage
    of new space.
    ```sh
    $ parted -l
    Model: Google PersistentDisk (scsi)
    Disk /dev/sda: 107GB
    Sector size (logical/physical): 512B/4096B
    Partition Table: gpt
    Disk Flags:
    Number Start End Size File system Name Flags
    14 1049kB 5243kB 4194kB bios_grub
    15 5243kB 116MB 111MB fat32 boot, esp
    1 116MB 107GB 107GB ext4
    Warning: Not all of the space available to /dev/sdb appears to be used, you can
    fix the GPT to use all of the space (an extra 20971520 blocks) or continue with
    the current setting?
    Fix/Ignore? Fix
    Model: Google PersistentDisk (scsi)
    Disk /dev/sdb: 21.5GB
    Sector size (logical/physical): 512B/4096B
    Partition Table: gpt
    Disk Flags:
    Number Start End Size File system Name Flags
    1 1049kB 10.7GB 10.7GB zfs zfs-d97901ec3aa0fb69
    9 10.7GB 10.7GB 8389kB
    ```
    ---------------------------------------------------------------------------------------

    ## 6. Remove the buffering partition
    ```sh
    parted /dev/sdb rm 9
    ```

    ## 7. Expand partition holding zpool
    parted /dev/sdb resizepart 1 100%
    ```
    sh: 1: udevadm: not found
    sh: 1: udevadm: not found
    Information: You may need to update /etc/fstab.
    ```
    ## 8. Check the parted size again
    ```
    root@cstor-pool-1fth-7fbbdfc747-sh25t:/# parted -l
    Model: Google PersistentDisk (scsi)
    Disk /dev/sda: 107GB
    Sector size (logical/physical): 512B/4096B
    Partition Table: gpt
    Disk Flags:

    Number Start End Size File system Name Flags
    14 1049kB 5243kB 4194kB bios_grub
    15 5243kB 116MB 111MB fat32 boot, esp
    1 116MB 107GB 107GB ext4


    Model: Google PersistentDisk (scsi)
    Disk /dev/sdb: 21.5GB
    Sector size (logical/physical): 512B/4096B
    Partition Table: gpt
    Disk Flags:

    Number Start End Size File system Name Flags
    1 1049kB 21.5GB 21.5GB zfs zfs-d97901ec3aa0fb69
    ```
    ## 9. Size is changed from 10GB to 20GB, Now we have to tell the zpool to expand/online using following command.
    ```sh
    zpool online -e cstor-5be1d388-60d3-11e9-8e67-42010aa00fcf /dev/disk/by-id/scsi-0Google_PersistentDisk_pdisk2
    ```