sudo apt-get install -y parted
sudo partprobe
sudo e2fsck -f /dev/sdx
sudo resize2fs /dev/sdx
sudo e2fsck -f /dev/sdx
sudo getfacl -pR /bin /usr /home /var /etc /lib* /tmp /mnt /media /dev /boot /sbin /srv >bin.perm
sudo setfacl --restore=bin.perm
sudo apt-get install -y parted
sudo partprobe
sudo e2fsck -f /dev/sdx
sudo resize2fs /dev/sdx
sudo e2fsck -f /dev/sdx
sudo getfacl -pR /bin /usr /home /var /etc /lib* /tmp /mnt /media /dev /boot /sbin /srv >bin.perm
sudo setfacl --restore=bin.perm