Hi guys,
I want to write a script to automate partitioning for some project that I'm working on. I tried using fdisk but it was too painful... so, turned to sfdisk but now I'm getting strange results...or at least I think so.
What I want to do is, to get the disk size to be created from another script and create a partition of that size on the specific disk (also sent by the same script).
i.e. I want to create a partition with size of 5GB on /dev/hda.
First of all, do I need to convert GB to cylinders or blocks or sfdisk supports "GB" or "MB"?
Here's from my command prompt. Here's the strange thing that happens:
I have this:
Quote:
root# fdisk -l
Disk /dev/hda: 8589 MB, 8589934592 bytes
16 heads, 63 sectors/track, 16644 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Device Boot Start End Blocks Id System
/dev/hda1 1 1000 503968+ 83 Linux
/dev/hda2 1001 16644 7884576 5 Extended
/dev/hda5 1001 2939 977224+ 83 Linux
/dev/hda6 2940 4878 977224+ 83 Linux
/dev/hda7 4879 5848 488848+ 83 Linux
/dev/hda8 5849 7787 977224+ 83 Linux
/dev/hda9 8781 10719 977224+ 83 Linux
/dev/hda10 10720 16644 2986168+ 83 Linux
/dev/hda11 7788 8036 125464+ 83 Linux
Partition table entries are not in disk order
Disk /dev/hdd: 5604 MB, 5604638720 bytes
16 heads, 63 sectors/track, 10859 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Device Boot Start End Blocks Id System
/dev/hdd1 1 3876 1953472+ 83 Linux
/dev/hdd2 3877 7752 1953504 83 Linux
/dev/hdd4 7753 10859 1565928 5 Extended
/dev/hdd5 7753 10859 1565896+ 83 Linux
and I want to add a new partition to /dev/hda:
Quote:
root# sfdisk /dev/hda
Checking that no-one is using this disk right now ...
OK
Disk /dev/hda: 16644 cylinders, 16 heads, 63 sectors/track
Old situation:
Units = cylinders of 516096 bytes, blocks of 1024 bytes, counting from 0
Device Boot Start End #cyls #blocks Id System
/dev/hda1 0+ 999 1000- 503968+ 83 Linux
/dev/hda2 1000 16643 15644 7884576 5 Extended
/dev/hda3 0 - 0 0 0 Empty
/dev/hda4 0 - 0 0 0 Empty
/dev/hda5 1000+ 2938 1939- 977224+ 83 Linux
/dev/hda6 2939+ 4877 1939- 977224+ 83 Linux
/dev/hda7 4878+ 5847 970- 488848+ 83 Linux
/dev/hda8 5848+ 7786 1939- 977224+ 83 Linux
/dev/hda9 8780+ 10718 1939- 977224+ 83 Linux
/dev/hda10 10719+ 16643 5925- 2986168+ 83 Linux
/dev/hda11 7787+ 8035 249- 125464+ 83 Linux
Input in the following format; absent fields get a default value.
<start> <size> <type [E,S,L,X,hex]> <bootable [-,*]> <c,h,s> <c,h,s>
Usually you only need to specify <start> and <size> (and perhaps <type>).
/dev/hda1 :,,
/dev/hda1 0+ 16643 16644- 8388575+ 83 Linux
/dev/hda2 :
What happens is, when I want to keep the same size and everything for the rest of the partitions (by entering ",,"), it allocates the entire space for hda1...
What am I doing wrong guys? Please help!
Thanks