Re: how to calculate correct values for resize2fs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Jelle

1. Please don't CC to poster if you answer, we are all on this list and
   get the messages anyways.

2. And please don't full-quote if not *really* necessary.

3. From your other mail:
   > The problem is I have to automate this process
   That's an important information you forgot to mention in the initial
   post ;)

* Jelle de Jong <jelledejong@xxxxxxxxxxxxx> hat geschrieben:

> $ fdisk -l /dev/sda
> Disk /dev/sda: 4034 MB, 4034838528 bytes

> bc <<< "4034-16"
> resize2fs /dev/sda1 4018M
> 
> # result: partition is only 983973 (4K) blocks
> # requested: 1028608 blocks
> # will not fit exiting

4034838528 is 3847 MB and not 4034 like fdisk told you. Obviously fdisk is 
using that bogus SI-numbering.

4018*1024^2 is 1028608 clusters and the underlaying block device of the 
file system only supports 983973 clusters (which it already provides).

So: Take the bytes value, devide it by 1024^2 to gain the real number of
MBs and subtract 18 (not 16) MB in the first call to resize2fs like this:

resize2fs -p /dev/sda1 $(echo "
	scale=0;
	$(
		export LANG=C
		fdisk -l /dev/sda | grep sda: | awk '{ print $5 }'
	)/1024^2-18
" | bc)

Then shrink the partition by 16 MB then resize2fs /dev/sda1 without
argument again to fill up the unused space again.

Remember my advice from the previous mail I'v written as well.

Regards, Bodo

_______________________________________________
Ext3-users mailing list
Ext3-users@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/ext3-users

[Index of Archives]         [Linux RAID]     [Kernel Development]     [Red Hat Install]     [Video 4 Linux]     [Postgresql]     [Fedora]     [Gimp]     [Yosemite News]

  Powered by Linux