By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,603 Members | 1,093 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,603 IT Pros & Developers. It's quick & easy.

Partitioning with sfdisk

Colloid Snake
100+
P: 144
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
Aug 22 '08 #1
Share this Question
Share on Google+
1 Reply

Motoma
Expert 2.5K+
P: 3,237
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:

Expand|Select|Wrap|Line Numbers
  1. sfdisk -uM -x /dev/sda << EOF
  2. ,2048,L,*
  3. ,2048,S
  4. ,,E
  5. ,1024,L
  6. ,1024,L
  7. ,,L
  8. ;
  9. ;
  10. EOF
  11.  
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
Aug 26 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.