You should not use df
because it shows the size as reported by the filesystem (in this case, ext4).
Use the dumpe2fs -h /dev/mapper/ExistingExt4
command to find out the real size of the partition. The -h
option makes dumpe2fs
show super block info without a lot other unnecessary details. From the output, you need the block count and block size.
...
Block count: 19506168
Reserved block count: 975308
Free blocks: 13750966
Free inodes: 4263842
First block: 0
Block size: 4096
...
Multiplicating these values will give the partition size in bytes.
The above numbers happen to be a perfect multiple of 1024, so we can calculate the result in KiB:
$ python -c 'print 19506168.0 * 4096 / 1024' # python2
$ python -c 'print(19506168.0 * 4096 / 1024)' # python3
78024672.0
Since you want to shrink the partition by 15 GiB (which is 15 MiB times 1 KiB):
$ python -c 'print 19506168.0 * 4096 / 1024 - 15 * 1024 * 1024' #python2
$ python -c 'print(19506168.0 * 4096 / 1024 - 15 * 1024 * 1024)' #python3
62296032.0
As resize2fs
accepts several kinds of suffixes, one of them being K
for "1024 bytes", the command for shrinking the partition to 62296032 KiB becomes:
resize2fs -p /dev/mapper/ExistingExt4 62296032K
Without unit, the number will be interpreted as a multiple of the filesystem's blocksize (4096 in this case). See man resize2fs(8)