My question is similar to Move ext4 partition, but the challenge I couldn't figure out is how to shrink a partition from the start.
So suppose originally the partition (with raid) is like this.
(************** /dev/md127 ***************)
After resizing, I want to achieve like this.
(*** unallocated ***)(**** /dev/md127 ****)
Note, I cannot use gparted, and parted does not support ext4.
The commands I have tried so far,
% resize2fs -p /dev/md127 1676G # <== This is good.
% lvreduce -L 1676G /dev/md127
Path required for Logical Volume "md127"
Please provide a volume group name
Run `lvreduce --help' for more information.
Then I found some link (http://www.howtoforge.com/how-to-resize-raid-partitions-shrink-and-grow-software-raid) that describing how to change partition of raid.
$ mdadm --grow /dev/md127 --size=max
mdadm: Cannot set device size for /dev/md127: Invalid argument
Failed here, "man mdadm" shows that "--grow" does not with raid 10. Need some help. Note, I use "--size=max" just for quick test, it won't work with other values either.
Then after that, I am thinking to create another partition right after this one, copy the data to that partition, and remove this one, like.
1. (************** /dev/md127 ***************)
2. (**** /dev/md127 ****)(*** new partition **)
3. (*** unallocated ****)(**** /dev/md127 ****)
Thanks.