I had 2 1Tb drives in my Synology DS212j in RAID1 (or Synology Hybrid Raid), and I ran out of space.
- Resize physical partition on the drive to fill all available space (eg, /dev/sda3)
- Resize RAID1 array on top of /dev/sda3 (eg, /dev/md2)
- Resize LVM physical volume on top of /dev/md2
- Resize LVM volume group, built from the physical volume (eg, /dev/vg1000)
- Resize LVM logical volume, spanning over the /dev/vg1000 (eg, /dev/vg1000/lv)
- Resize ext4 filesystem on top of /dev/vg1000/lv
- unit s - this makes parted use units of sectors instead of Mb/Gb/etc - this is cruicial to be exact in recreating your new partition
- print free - will list the current partition table along with the free space in the end
- rm 3 - will delete 3rd parition (check if it is the correct number, mine had 5 for some odd reason)
- mkpart ext4 - will create a new partition in its place, make sure to specify the same start sector as was printed, and the last sector of the free space, so you will use the whole disk. If it complains about alignment, press ignore - it will still be minimally aligned.
- Now reboot - I didn't find a working method of forcing Synology kernel to reread the partition table. Even though my data partition was /dev/sda5 and after recreation became /dev/sda3, Linux RAID was still able to detect it (probably using UUID) after reboot and assemble RAID array correctly.
- Stop all Synology apps in the GUI, like Download manager and others.
- Stop other services accessing the filesystem (/volume1), I had to stop these:
- umount /volume1
- umount -f /volume1/@optware - this was tricker, thus -f. After that you will probably loose your SSH session. Go to the web GUI and enable SSH again in Control Panel/Terminal.
- umount /volume1/@optware - after reconnecting, you need to do this once more
- vgchange -a n - this will disable your LVM volume group, disabling also the logical volume. This will work only if the both /volume1 and /volume1/@optware are unmounted.
- mdadm -S /dev/md2 - only now you can stop the RAID array
- mdadm -A /dev/md2 -U devicesize /dev/sda3 - this will reassemble the RAID array, updating the device size
- mdadm --grow /dev/md2 -z max - finally, growing of the array will work!
- vgdisplay -v - will show you everything, use it to check your resizing steps.
- pvresize /dev/md2 - will use all available space on /dev/md2
- vgdisplay -v - will show you how much free space you have in your PV
- lvextend -L+100G /dev/vg1000/lv - will extend the LV by 100 Gb. You can specify the exact amount of free space reported by vgdisplay here, or just do it several times until no free space is available.
- e2fsck -f /dev/vg1000/lv - this is the required step before doing the actual resize.
- resize2fs /dev/vg1000/lv - this will take a long time again