Created
March 6, 2017 16:01
-
-
Save tuxfight3r/c640ab9d8eb3806a22b989581bcbed43 to your computer and use it in GitHub Desktop.
use sfdisk to create scripted partitions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##create one big partition | |
echo ';' | sfdisk /dev/sdc | |
##create one big partition with specific partition type | |
#creates W95 FAT32 (LBA) | |
echo ',,c;' | sfdisk /dev/sdd | |
#creates lvm type | |
echo ',,8e;' | sfdisk /dev/sdd | |
##Three primary partitions: two of size 50MB and the rest: | |
sfdisk /dev/hda -uM << EOF | |
,50 | |
,50 | |
; | |
EOF | |
##A 1MB OS2 Boot Manager partition, a 50MB DOS partition, and three extended partitions (DOS D:, Linux swap, Linux): | |
sfdisk /dev/hda -uM << EOF | |
,1,a | |
,50,6 | |
,,E | |
; | |
,20,4 | |
,16,S | |
; | |
EOF | |
#Useful commands | |
sfdisk -l /dev/hda #list partitions | |
sfdisk -l -x /dev/hda #list extended partitions | |
sfdisk -T #list partition types |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
is it possible to use sfdisk to create an extended partition on a left free space on a disk ?
thanks