How to keep sfdisk working?












5















I updated to Ubuntu 15.10 but it causes a huge issue for me: sfdisk doesn't work anymore.



I really need sfdisk to build partitions on SD card for my embedded Linux but it seems that options have changed.



Here is my script:



CARD_DEV=$1

unset LANG

umount ${CARD_DEV}* >& /dev/null

if [ -b "$CARD_DEV" ] ; then
echo "*************** Formatting SD card... ***************"
dd if=/dev/zero of=$CARD_DEV bs=1024 count=1024
SIZE=`fdisk -l $CARD_DEV | grep Disk | awk '{print $5}'`
echo DISK SIZE - $SIZE bytes
CYLINDERS=`echo $SIZE/255/63/512 | bc`
echo CYLINDERS - $CYLINDERS
{
echo 1,9,0x0C,*
echo 10,,,-
} | sfdisk -D -H 255 -S 63 -C $CYLINDERS $CARD_DEV
mkfs.vfat -F 32 -n "boot" ${CARD_DEV}1
mke2fs -j -L "filesystem" ${CARD_DEV}2
fi


And the output error:



sfdisk: invalid option -- 'D'

sfdisk [options] <dev> [[-N] <part>]
sfdisk [options] <command>

Display or manipulate a disk partition table.

Commands:
-A, --activate <dev> [<part> ...] list or set bootable MBR partitions
-d, --dump <dev> dump partition table (usable for later input)
-g, --show-geometry [<dev> ...] list geometry of all or specified devices
-l, --list [<dev> ...] list partitions of each device
-s, --show-size [<dev> ...] list sizes of all or specified devices
-T, --list-types print the recognized types (see -X)
-V, --verify test whether partitions seem correct

--part-label <dev> <part> [<str>] print or change partition label
--part-type <dev> <part> [<type>] print or change partition type
--part-uuid <dev> <part> [<uuid>] print or change partition uuid
--part-attrs <dev> <part> [<str>] print or change partition attributes

<dev> device (usually disk) path
<part> partition number
<type> partition type, GUID for GPT, hex for MBR

Options:
-a, --append append partitions to existing partition table
-b, --backup backup partition table sectors (see -O)
--bytes print SIZE in bytes rather than in human readable format
-f, --force disable all consistency checking
--color[=<when>] colorize output (auto, always or never)
colors disabled by default
-N, --partno <num> specify partition number
-n, --no-act do everything except write to device
--no-reread do not check whether the device is in use
-O, --backup-file <path> override default backup file name
-o, --output <list> output columns
-q, --quiet suppress extra info messages
-X, --label <name> specify label type (dos, gpt, ...)
-Y, --label-nested <name> specify nested label type (dos, bsd)

-L, --Linux deprecated, only for backward compatibility
-u, --unit S deprecated, only sector unit is supported

-h, --help display this help and exit
-v, --version output version information and exit

Available columns (for -o):
gpt: Device Start End Sectors Size Type Type-UUID Attrs Name UUID
dos: Device Start End Sectors Cylinders Size Type Id Attrs Boot End-C/H/S
Start-C/H/S
bsd: Slice Start End Sectors Cylinders Size Type Bsize Cpg Fsize
sgi: Device Start End Sectors Cylinders Size Type Id Attrs
sun: Device Start End Sectors Cylinders Size Type Id Flags

For more details see sfdisk(8).


Version:



sfdisk from util-linux 2.26.2









share|improve this question

























  • Instead of this: sfdisk -D -H 255 -S 63 -C $CYLINDERS $CARD_DEV | Try this: sfdisk --DOS -H 255 -S 63 -C $CYLINDERS $CARD_DEV

    – Raphael
    Nov 10 '15 at 14:37













  • I get sfdisk: unrecognized option '--DOS'. It seems that all the options I use were removed :S

    – didil
    Nov 10 '15 at 14:49











  • Version 2.26 of sfdisk changed this: Since version 2.26 sfdisk supports MBR (DOS), GPT, SUN and SGI disk labels, but no longer provides any functionality for CHS (Cylinder- Head-Sector)

    – Tobias
    Nov 10 '15 at 15:10











  • OK. So how to continue to create partitions? Will it works with my embedded system?

    – didil
    Nov 10 '15 at 15:12











  • The man page is still the old version.

    – didil
    Nov 10 '15 at 15:58
















5















I updated to Ubuntu 15.10 but it causes a huge issue for me: sfdisk doesn't work anymore.



I really need sfdisk to build partitions on SD card for my embedded Linux but it seems that options have changed.



Here is my script:



CARD_DEV=$1

unset LANG

umount ${CARD_DEV}* >& /dev/null

if [ -b "$CARD_DEV" ] ; then
echo "*************** Formatting SD card... ***************"
dd if=/dev/zero of=$CARD_DEV bs=1024 count=1024
SIZE=`fdisk -l $CARD_DEV | grep Disk | awk '{print $5}'`
echo DISK SIZE - $SIZE bytes
CYLINDERS=`echo $SIZE/255/63/512 | bc`
echo CYLINDERS - $CYLINDERS
{
echo 1,9,0x0C,*
echo 10,,,-
} | sfdisk -D -H 255 -S 63 -C $CYLINDERS $CARD_DEV
mkfs.vfat -F 32 -n "boot" ${CARD_DEV}1
mke2fs -j -L "filesystem" ${CARD_DEV}2
fi


And the output error:



sfdisk: invalid option -- 'D'

sfdisk [options] <dev> [[-N] <part>]
sfdisk [options] <command>

Display or manipulate a disk partition table.

Commands:
-A, --activate <dev> [<part> ...] list or set bootable MBR partitions
-d, --dump <dev> dump partition table (usable for later input)
-g, --show-geometry [<dev> ...] list geometry of all or specified devices
-l, --list [<dev> ...] list partitions of each device
-s, --show-size [<dev> ...] list sizes of all or specified devices
-T, --list-types print the recognized types (see -X)
-V, --verify test whether partitions seem correct

--part-label <dev> <part> [<str>] print or change partition label
--part-type <dev> <part> [<type>] print or change partition type
--part-uuid <dev> <part> [<uuid>] print or change partition uuid
--part-attrs <dev> <part> [<str>] print or change partition attributes

<dev> device (usually disk) path
<part> partition number
<type> partition type, GUID for GPT, hex for MBR

Options:
-a, --append append partitions to existing partition table
-b, --backup backup partition table sectors (see -O)
--bytes print SIZE in bytes rather than in human readable format
-f, --force disable all consistency checking
--color[=<when>] colorize output (auto, always or never)
colors disabled by default
-N, --partno <num> specify partition number
-n, --no-act do everything except write to device
--no-reread do not check whether the device is in use
-O, --backup-file <path> override default backup file name
-o, --output <list> output columns
-q, --quiet suppress extra info messages
-X, --label <name> specify label type (dos, gpt, ...)
-Y, --label-nested <name> specify nested label type (dos, bsd)

-L, --Linux deprecated, only for backward compatibility
-u, --unit S deprecated, only sector unit is supported

-h, --help display this help and exit
-v, --version output version information and exit

Available columns (for -o):
gpt: Device Start End Sectors Size Type Type-UUID Attrs Name UUID
dos: Device Start End Sectors Cylinders Size Type Id Attrs Boot End-C/H/S
Start-C/H/S
bsd: Slice Start End Sectors Cylinders Size Type Bsize Cpg Fsize
sgi: Device Start End Sectors Cylinders Size Type Id Attrs
sun: Device Start End Sectors Cylinders Size Type Id Flags

For more details see sfdisk(8).


Version:



sfdisk from util-linux 2.26.2









share|improve this question

























  • Instead of this: sfdisk -D -H 255 -S 63 -C $CYLINDERS $CARD_DEV | Try this: sfdisk --DOS -H 255 -S 63 -C $CYLINDERS $CARD_DEV

    – Raphael
    Nov 10 '15 at 14:37













  • I get sfdisk: unrecognized option '--DOS'. It seems that all the options I use were removed :S

    – didil
    Nov 10 '15 at 14:49











  • Version 2.26 of sfdisk changed this: Since version 2.26 sfdisk supports MBR (DOS), GPT, SUN and SGI disk labels, but no longer provides any functionality for CHS (Cylinder- Head-Sector)

    – Tobias
    Nov 10 '15 at 15:10











  • OK. So how to continue to create partitions? Will it works with my embedded system?

    – didil
    Nov 10 '15 at 15:12











  • The man page is still the old version.

    – didil
    Nov 10 '15 at 15:58














5












5








5


0






I updated to Ubuntu 15.10 but it causes a huge issue for me: sfdisk doesn't work anymore.



I really need sfdisk to build partitions on SD card for my embedded Linux but it seems that options have changed.



Here is my script:



CARD_DEV=$1

unset LANG

umount ${CARD_DEV}* >& /dev/null

if [ -b "$CARD_DEV" ] ; then
echo "*************** Formatting SD card... ***************"
dd if=/dev/zero of=$CARD_DEV bs=1024 count=1024
SIZE=`fdisk -l $CARD_DEV | grep Disk | awk '{print $5}'`
echo DISK SIZE - $SIZE bytes
CYLINDERS=`echo $SIZE/255/63/512 | bc`
echo CYLINDERS - $CYLINDERS
{
echo 1,9,0x0C,*
echo 10,,,-
} | sfdisk -D -H 255 -S 63 -C $CYLINDERS $CARD_DEV
mkfs.vfat -F 32 -n "boot" ${CARD_DEV}1
mke2fs -j -L "filesystem" ${CARD_DEV}2
fi


And the output error:



sfdisk: invalid option -- 'D'

sfdisk [options] <dev> [[-N] <part>]
sfdisk [options] <command>

Display or manipulate a disk partition table.

Commands:
-A, --activate <dev> [<part> ...] list or set bootable MBR partitions
-d, --dump <dev> dump partition table (usable for later input)
-g, --show-geometry [<dev> ...] list geometry of all or specified devices
-l, --list [<dev> ...] list partitions of each device
-s, --show-size [<dev> ...] list sizes of all or specified devices
-T, --list-types print the recognized types (see -X)
-V, --verify test whether partitions seem correct

--part-label <dev> <part> [<str>] print or change partition label
--part-type <dev> <part> [<type>] print or change partition type
--part-uuid <dev> <part> [<uuid>] print or change partition uuid
--part-attrs <dev> <part> [<str>] print or change partition attributes

<dev> device (usually disk) path
<part> partition number
<type> partition type, GUID for GPT, hex for MBR

Options:
-a, --append append partitions to existing partition table
-b, --backup backup partition table sectors (see -O)
--bytes print SIZE in bytes rather than in human readable format
-f, --force disable all consistency checking
--color[=<when>] colorize output (auto, always or never)
colors disabled by default
-N, --partno <num> specify partition number
-n, --no-act do everything except write to device
--no-reread do not check whether the device is in use
-O, --backup-file <path> override default backup file name
-o, --output <list> output columns
-q, --quiet suppress extra info messages
-X, --label <name> specify label type (dos, gpt, ...)
-Y, --label-nested <name> specify nested label type (dos, bsd)

-L, --Linux deprecated, only for backward compatibility
-u, --unit S deprecated, only sector unit is supported

-h, --help display this help and exit
-v, --version output version information and exit

Available columns (for -o):
gpt: Device Start End Sectors Size Type Type-UUID Attrs Name UUID
dos: Device Start End Sectors Cylinders Size Type Id Attrs Boot End-C/H/S
Start-C/H/S
bsd: Slice Start End Sectors Cylinders Size Type Bsize Cpg Fsize
sgi: Device Start End Sectors Cylinders Size Type Id Attrs
sun: Device Start End Sectors Cylinders Size Type Id Flags

For more details see sfdisk(8).


Version:



sfdisk from util-linux 2.26.2









share|improve this question
















I updated to Ubuntu 15.10 but it causes a huge issue for me: sfdisk doesn't work anymore.



I really need sfdisk to build partitions on SD card for my embedded Linux but it seems that options have changed.



Here is my script:



CARD_DEV=$1

unset LANG

umount ${CARD_DEV}* >& /dev/null

if [ -b "$CARD_DEV" ] ; then
echo "*************** Formatting SD card... ***************"
dd if=/dev/zero of=$CARD_DEV bs=1024 count=1024
SIZE=`fdisk -l $CARD_DEV | grep Disk | awk '{print $5}'`
echo DISK SIZE - $SIZE bytes
CYLINDERS=`echo $SIZE/255/63/512 | bc`
echo CYLINDERS - $CYLINDERS
{
echo 1,9,0x0C,*
echo 10,,,-
} | sfdisk -D -H 255 -S 63 -C $CYLINDERS $CARD_DEV
mkfs.vfat -F 32 -n "boot" ${CARD_DEV}1
mke2fs -j -L "filesystem" ${CARD_DEV}2
fi


And the output error:



sfdisk: invalid option -- 'D'

sfdisk [options] <dev> [[-N] <part>]
sfdisk [options] <command>

Display or manipulate a disk partition table.

Commands:
-A, --activate <dev> [<part> ...] list or set bootable MBR partitions
-d, --dump <dev> dump partition table (usable for later input)
-g, --show-geometry [<dev> ...] list geometry of all or specified devices
-l, --list [<dev> ...] list partitions of each device
-s, --show-size [<dev> ...] list sizes of all or specified devices
-T, --list-types print the recognized types (see -X)
-V, --verify test whether partitions seem correct

--part-label <dev> <part> [<str>] print or change partition label
--part-type <dev> <part> [<type>] print or change partition type
--part-uuid <dev> <part> [<uuid>] print or change partition uuid
--part-attrs <dev> <part> [<str>] print or change partition attributes

<dev> device (usually disk) path
<part> partition number
<type> partition type, GUID for GPT, hex for MBR

Options:
-a, --append append partitions to existing partition table
-b, --backup backup partition table sectors (see -O)
--bytes print SIZE in bytes rather than in human readable format
-f, --force disable all consistency checking
--color[=<when>] colorize output (auto, always or never)
colors disabled by default
-N, --partno <num> specify partition number
-n, --no-act do everything except write to device
--no-reread do not check whether the device is in use
-O, --backup-file <path> override default backup file name
-o, --output <list> output columns
-q, --quiet suppress extra info messages
-X, --label <name> specify label type (dos, gpt, ...)
-Y, --label-nested <name> specify nested label type (dos, bsd)

-L, --Linux deprecated, only for backward compatibility
-u, --unit S deprecated, only sector unit is supported

-h, --help display this help and exit
-v, --version output version information and exit

Available columns (for -o):
gpt: Device Start End Sectors Size Type Type-UUID Attrs Name UUID
dos: Device Start End Sectors Cylinders Size Type Id Attrs Boot End-C/H/S
Start-C/H/S
bsd: Slice Start End Sectors Cylinders Size Type Bsize Cpg Fsize
sgi: Device Start End Sectors Cylinders Size Type Id Attrs
sun: Device Start End Sectors Cylinders Size Type Id Flags

For more details see sfdisk(8).


Version:



sfdisk from util-linux 2.26.2






partitioning updates embedded-system






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 10 '15 at 15:04







didil

















asked Nov 10 '15 at 14:32









didildidil

3114




3114













  • Instead of this: sfdisk -D -H 255 -S 63 -C $CYLINDERS $CARD_DEV | Try this: sfdisk --DOS -H 255 -S 63 -C $CYLINDERS $CARD_DEV

    – Raphael
    Nov 10 '15 at 14:37













  • I get sfdisk: unrecognized option '--DOS'. It seems that all the options I use were removed :S

    – didil
    Nov 10 '15 at 14:49











  • Version 2.26 of sfdisk changed this: Since version 2.26 sfdisk supports MBR (DOS), GPT, SUN and SGI disk labels, but no longer provides any functionality for CHS (Cylinder- Head-Sector)

    – Tobias
    Nov 10 '15 at 15:10











  • OK. So how to continue to create partitions? Will it works with my embedded system?

    – didil
    Nov 10 '15 at 15:12











  • The man page is still the old version.

    – didil
    Nov 10 '15 at 15:58



















  • Instead of this: sfdisk -D -H 255 -S 63 -C $CYLINDERS $CARD_DEV | Try this: sfdisk --DOS -H 255 -S 63 -C $CYLINDERS $CARD_DEV

    – Raphael
    Nov 10 '15 at 14:37













  • I get sfdisk: unrecognized option '--DOS'. It seems that all the options I use were removed :S

    – didil
    Nov 10 '15 at 14:49











  • Version 2.26 of sfdisk changed this: Since version 2.26 sfdisk supports MBR (DOS), GPT, SUN and SGI disk labels, but no longer provides any functionality for CHS (Cylinder- Head-Sector)

    – Tobias
    Nov 10 '15 at 15:10











  • OK. So how to continue to create partitions? Will it works with my embedded system?

    – didil
    Nov 10 '15 at 15:12











  • The man page is still the old version.

    – didil
    Nov 10 '15 at 15:58

















Instead of this: sfdisk -D -H 255 -S 63 -C $CYLINDERS $CARD_DEV | Try this: sfdisk --DOS -H 255 -S 63 -C $CYLINDERS $CARD_DEV

– Raphael
Nov 10 '15 at 14:37







Instead of this: sfdisk -D -H 255 -S 63 -C $CYLINDERS $CARD_DEV | Try this: sfdisk --DOS -H 255 -S 63 -C $CYLINDERS $CARD_DEV

– Raphael
Nov 10 '15 at 14:37















I get sfdisk: unrecognized option '--DOS'. It seems that all the options I use were removed :S

– didil
Nov 10 '15 at 14:49





I get sfdisk: unrecognized option '--DOS'. It seems that all the options I use were removed :S

– didil
Nov 10 '15 at 14:49













Version 2.26 of sfdisk changed this: Since version 2.26 sfdisk supports MBR (DOS), GPT, SUN and SGI disk labels, but no longer provides any functionality for CHS (Cylinder- Head-Sector)

– Tobias
Nov 10 '15 at 15:10





Version 2.26 of sfdisk changed this: Since version 2.26 sfdisk supports MBR (DOS), GPT, SUN and SGI disk labels, but no longer provides any functionality for CHS (Cylinder- Head-Sector)

– Tobias
Nov 10 '15 at 15:10













OK. So how to continue to create partitions? Will it works with my embedded system?

– didil
Nov 10 '15 at 15:12





OK. So how to continue to create partitions? Will it works with my embedded system?

– didil
Nov 10 '15 at 15:12













The man page is still the old version.

– didil
Nov 10 '15 at 15:58





The man page is still the old version.

– didil
Nov 10 '15 at 15:58










1 Answer
1






active

oldest

votes


















0














This seems to be a working version of the command that works in both old and new sfdisk versions.



# p1 74MB FAT
# p2 Remainder Linux
sfdisk -u S -L $CARD_DEV << EOF
63,144522,0x0C,*
160650,,,-
EOF


"-u S" sets the units to sectors which is default in the new version but required to be set in old version



"-L" keeps the old version from erroring out when creating the partitions.



source: https://e2e.ti.com/support/arm/sitara_arm/f/791/t/509510






share|improve this answer

























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f696274%2fhow-to-keep-sfdisk-working%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    This seems to be a working version of the command that works in both old and new sfdisk versions.



    # p1 74MB FAT
    # p2 Remainder Linux
    sfdisk -u S -L $CARD_DEV << EOF
    63,144522,0x0C,*
    160650,,,-
    EOF


    "-u S" sets the units to sectors which is default in the new version but required to be set in old version



    "-L" keeps the old version from erroring out when creating the partitions.



    source: https://e2e.ti.com/support/arm/sitara_arm/f/791/t/509510






    share|improve this answer






























      0














      This seems to be a working version of the command that works in both old and new sfdisk versions.



      # p1 74MB FAT
      # p2 Remainder Linux
      sfdisk -u S -L $CARD_DEV << EOF
      63,144522,0x0C,*
      160650,,,-
      EOF


      "-u S" sets the units to sectors which is default in the new version but required to be set in old version



      "-L" keeps the old version from erroring out when creating the partitions.



      source: https://e2e.ti.com/support/arm/sitara_arm/f/791/t/509510






      share|improve this answer




























        0












        0








        0







        This seems to be a working version of the command that works in both old and new sfdisk versions.



        # p1 74MB FAT
        # p2 Remainder Linux
        sfdisk -u S -L $CARD_DEV << EOF
        63,144522,0x0C,*
        160650,,,-
        EOF


        "-u S" sets the units to sectors which is default in the new version but required to be set in old version



        "-L" keeps the old version from erroring out when creating the partitions.



        source: https://e2e.ti.com/support/arm/sitara_arm/f/791/t/509510






        share|improve this answer















        This seems to be a working version of the command that works in both old and new sfdisk versions.



        # p1 74MB FAT
        # p2 Remainder Linux
        sfdisk -u S -L $CARD_DEV << EOF
        63,144522,0x0C,*
        160650,,,-
        EOF


        "-u S" sets the units to sectors which is default in the new version but required to be set in old version



        "-L" keeps the old version from erroring out when creating the partitions.



        source: https://e2e.ti.com/support/arm/sitara_arm/f/791/t/509510







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Sep 1 '16 at 14:43

























        answered Sep 1 '16 at 14:01









        jjcf89jjcf89

        1234




        1234






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f696274%2fhow-to-keep-sfdisk-working%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How did Captain America manage to do this?

            迪纳利

            南乌拉尔铁路局