16
Software / Sfdisk Partitioning Question
« on: November 02, 2007, 05:37:48 am »
Okay guys, I have solved the problem myself.
I use fdisk -l output first to read the total size of the card,
then I calculate the data partition size by substracting the wanted swap partitoin size (here 200MB),
then I create the data partition and swap partition using sfdisk and the calculated data partition size.
Seems to work very well.
daniel
I use fdisk -l output first to read the total size of the card,
then I calculate the data partition size by substracting the wanted swap partitoin size (here 200MB),
then I create the data partition and swap partition using sfdisk and the calculated data partition size.
Code: [Select]
#!/bin/bash
SDSIZE=`fdisk -l /dev/mmcda | grep "Disk /dev/mmcda" | cut -f 3 -d " "`
SWAPSIZE=200
DATASIZE=$[$SDSIZE-$SWAPSIZE]
echo SD card size: $SSIZE MB
echo Size for data partition: $DATASIZE MB
echo Size for swap partition: $SWAPSIZE MB
sfdisk /dev/mmcda -uM << EOF
,$DATASIZE,L,*
,,S,
;
EOF
Seems to work very well.
daniel