Comment 1 for bug 36268

Revision history for this message
Alexandre Otto Strube (surak) wrote :

I just checked gparted's source. It simply calls mkswap, which doesn't set
partition type.

According to mkswap's manpage:

" The device argument will usually be a disk partition (something like
       /dev/hda4 or /dev/sdb7) but can also be a file. The Linux kernel does
       not look at partition Id’s, but many installation scripts will assume
       that partitions of hex type 82 (LINUX_SWAP) are meant to be swap parti‐
       tions. (Warning: Solaris also uses this type. Be careful not to kill
       your Solaris partitions.)

"

This glitch lies in linux_swap.cc, from line 49 to 52:

bool linux_swap::Create( const Partition & new_partition )
{
        return ! Execute_Command( "mkswap " + new_partition .partition ) ;
}

perhaps a call after the mkswap command, something like: sfdisk --change-id
/dev/hdb 5 83 (well, you got the idea - this is sfdisk's manpage example :-) ).