Xpenology on VMware – Disk Extend

Recently I run out of free space on one of my XPenology DSM 6 drives and had to run an extend.

Since it’s running on ESXi, the VMware disk extend was easy. However surprisingly or not the Synology part wasn’t. The GUI does not allow you to increase the size of the RAID Group (in my case Basic without protection – single disk RAID1, Storage Manager–>RAID Group–>Manage the “Expand” option is grayed out)

So it was obvious manual resize through SSH is necessary.

After some time spend on googling good articles for doing this, the best one i found was http://blog.azib.net/2013/12/how-i-upgraded-my-synology-nas-to.html. It explains quite well the overall process of manually extend the volume (extend the vmware disk partition, the MD device, the physical, virtual and logical LVM volumes) , however I found Step 1 from the guide as dangerous (the partition recreation with a larger one) so I decided to try the parted partition resize option instead.

Below are the commands used, but first PLEASE BACKUP YOUR DATA without attempting anything:

  1. Extend the Disk in the VMware VM and connect to Synology using SSH (sudo su as needed).
  2. parted – launch the parted partition editor
  3. select /dev/sdX – chose which drive to work with (in my case /dev/sdc)
  4. unit s – work with sectors instead of GBs (otherwise you might get a message saying you get outside of disk boundaries)
  5. print free – two reasons for running this – 1. make sure you work with the correct drive; and 2. that you see the free space provisioned from VMwareModel: VMware Virtual disk (scsi)
    Disk /dev/sdc: 6012954214s
    Sector size (logical/physical): 512B/512B
    Partition Table: gpt
    Disk Flags:

    Number Start End Size File system Name Flags
    34s 2047s 2014s Free Space
    1 2048s 4982527s 4980480s ext4 raid
    2 4982528s 9176831s 4194304s linux-swap(v1) raid
    9176832s 9437183s 260352s Free Space
    3 9437184s 5153755935s 5144318752s raid
    5153755936s 6012954180s 859198245s Free Space      <–the free space is after the last (3rd) partition in the disk

  6. resizepart – run the command to resize the partition
    1. Partition number? 3 <– enter the partition number to edit (replace with 3 with your partition number)
    2. End?  [5153755935s]? 6012954180s <–Enter the new last partition sector as seen in the print free command
  7. quit the parted editor
  8.  Now it’s time to extend the RAID MD device. To do it first you have to stop any activity on it
    1. lsof | grep volume 3 (if lsof is missing – install it from here http://ipkg.nslu2-linux.org/feeds/optware/syno-i686/cross/stable/) <– check for open files on the volume
    2. In my case only samba was using the drive and it was stopped by /usr/syno/etc.defaults/rc.sysv/S80samba.sh stop .Follow Anton’s guide since it’s more detailed on how to find & stop the service using the drives, especially if you work with the volume where Synology packages are installed – usually volume1.
    3. lsof | grep volume3 <– run it again to ensure nothing remains using the volume.
    4. umount /volume3 <– unmount the volume (the GUI might start reporting it as crashed – ignore this for the moment)
    5. vgchange -a n vg3 <– deactivate the LVM Volume Group. Replace vg3 with your VolumeGroup Name (use vgdisplay -v or vgs commands to identify it)
    6. Stop and Re-assemble the RAID array
      mdadm -S /dev/md5 <– replace /dev/md5 with your MD device
      mdadm -A /dev/md5 -U devicesize /dev/sdc3 <–replace /dev/md5 with your MD device and /dev/sdc3 with your disk partition
    7. mdadm –grow /dev/md5 -z max <–extend the size of the MD array
    8. pvresize /dev/md5 <–extend the LVM Physical Volume and you’ll see the free space in the Physical [email protected]:/usr/syno/etc# vgs
      VG #PV #LV #SN Attr VSize VFree
      vg1 1 2 0 wz–n- 895.40g 0
      vg2 1 2 0 wz–n- 415.40g 0
      vg3 1 2 0 wz–n- 2.80t 409.70g
    9. vgchange -a y vg3 <– Activate the LVM volume group
    10. lvextend -L +409GB /dev/vg3/volume_3 <–extend the VLM Logical Volume to the last full GB
    11. lvextend -L +712MB /dev/vg3/volume_3 <–extend it with the remaining MBs as well(use vgs to see how much exact MBs are outstanding)
    12. [email protected]:/usr/syno/etc# vgs <–run vgs to validate you’ve used all available free space
      VG #PV #LV #SN Attr VSize VFree
      vg1 1 2 0 wz–n- 895.40g 0
      vg2 1 2 0 wz–n- 415.40g 0
      vg3 1 2 0 wz–n- 2.80t 0
    13. mount /volume3 <–mount the volume
  9. At this stage I expected the Synology GUI to reflect the actual RAID group and volume size, but it wasn’t the case.  After a Reboot (which starts the stopped services as well) the RAID group started showing the correct size after the extension. The Volume was still with the old size, but the GUI was handy (Login in Synology–>Storage Manager –>Volume –>select volume 3 –>expand) and the volume was extended, which ended the procedure.

And REMEMBER”

ALWAYS BACKUP YOUR DATA FIRST!

Enjoy!