Hello!
I need to write partitioning script wich would work in rescue mode. It will prepare partitions and unpack linux on it. However I need to calculate whole size of the disk and create:
/dev/sda1 --> One big partition (minus (2*size of memory) for swap)
/dev/sda2 --> Swap partition (2*size of memory)
I know how to later do this using fdisk or sfdisk but how to get for example (disk size - (2*memory size)) the best would be in megabytes
free -m can give me memory size but
sfdisk -s gives disk size in blocks
fdisk -l give size (very nice) in GB
Disk /dev/sda: 750.1 GB, 750156374016 bytes
I'm confused how to calculate this properly. Can you help me??
Thank you in advance!