Partitioning with sfdisk

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Colloid Snake
    New Member
    • Nov 2006
    • 144

    #1

    Partitioning with sfdisk

    Hello-

    I am attempting to modify an install script, and I'm not having much luck - I was hoping someone could help with my sfdisk notation.

    Currently, the install script uses

    sfdisk -uM /dev/sda << EOF
    ,2048,,*
    ,2048,82
    ,,
    EOF

    And I'm attempting to add a few more partitions in there by using:

    sfdisk -uM /dev/sda << EOF
    ,2048,,*
    ,2048,82
    ,,E
    ,1024,
    ,1024,
    ,,
    EOF

    I have tried adding various sizes, but I continue to get "sda: p4 exceeds device capacity" on the extended partition. This is on an 8G VMware image, so unless that is using something other than MB (which I thought the -uM was setting), it should be small enough to fit in the rest of the space.

    Can anyone see what I'm doing wrong?

    ~Snake
  • Motoma
    Recognized Expert Specialist
    • Jan 2007
    • 3236

    #2
    Originally posted by Colloid Snake
    Hello-

    I am attempting to modify an install script, and I'm not having much luck - I was hoping someone could help with my sfdisk notation.

    Currently, the install script uses

    sfdisk -uM /dev/sda << EOF
    ,2048,,*
    ,2048,82
    ,,
    EOF

    And I'm attempting to add a few more partitions in there by using:

    sfdisk -uM /dev/sda << EOF
    ,2048,,*
    ,2048,82
    ,,E
    ,1024,
    ,1024,
    ,,
    EOF

    I have tried adding various sizes, but I continue to get "sda: p4 exceeds device capacity" on the extended partition. This is on an 8G VMware image, so unless that is using something other than MB (which I thought the -uM was setting), it should be small enough to fit in the rest of the space.

    Can anyone see what I'm doing wrong?

    ~Snake
    Hello Colloid Snake,

    I found this interesting bit of documentation in the man pages:
    With the -x option, the number of input lines must be a multiple of 4: you have to list the two empty partitions that you never want using two blank lines. Without the -x option, you give one line for the partitions inside a extended partition, instead of four, and terminate with end-of-file (^D). (And sfdisk will assume that your input line represents the first of four, that the second one is extended, and the 3rd and 4th are empty.)
    If I follow that correctly, what you probably will need is something like the following:

    Code:
    sfdisk -uM -x /dev/sda << EOF
    ,2048,L,*
    ,2048,S
    ,,E
    ,1024,L
    ,1024,L
    ,,L
    ;
    ;
    EOF
    If you can see what I was getting at, try fooling around with it. If you find something that works, post back; I'm interested in knowing what the proper syntax is.

    Motoma

    Comment

    Working...