All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Bartłomiej Solarz-Niesłuchowski" <Bartlomiej.Solarz-Niesluchowski@wit.edu.pl>
To: Karel Zak <kzak@redhat.com>
Cc: util-linux@vger.kernel.org, Lukasz Trabinski <lukasz@trabinski.net>
Subject: Re: label-id and sfdisk problem
Date: Tue, 21 Feb 2017 17:58:12 +0100	[thread overview]
Message-ID: <64bb45d8-dfe2-caf2-e451-2009302d0932@wit.edu.pl> (raw)
In-Reply-To: <20170221164928.geha65vjytxjsed5@ws.net.home>

[-- Attachment #1: Type: text/plain, Size: 5767 bytes --]

W dniu 2017-02-21 o 17:49, Karel Zak pisze:
> On Tue, Feb 21, 2017 at 05:31:25PM +0100, Bartłomiej Solarz-Niesłuchowski wrote:
>> Dear List,
>>
>> I have problem with setting label-id of dos partition table
>> The problem occurs when i use sfdisk:
>> 1. I "save" the partition table with sfdisk -d /dev/sda > saved.table (saved
>> file has label-id of partition table)
>> 2. then i restore this via sfdisk /dev/sda < saved.table
>> BUT
>> label-id of dos partition table can be changed in this operation e.g.:
>> when i run command such:
>> sfdisk -d /dev/sda > saved.table
>> sfdisk /dev/sda < saved.table
>> sfdisk -d /dev/sda
>> sfdisk /dev/sda < saved.table
>> sfdisk -d /dev/sda
>> sfdisk /dev/sda < saved.table
>> sfdisk -d /dev/sda
>>
>> each time when i restore partition table label-id of dos type partition
>> table is changed!
>>
>> For me it is essential that label-id is set exactly as previous because
>> after that i restore windows operationg system on this partitions and
>> windows take care about label-id of boot disk partition table
>>
>> Currently i use fdisk (expert option i) for setting label-id of partition,
>> but why it is not possible thru sfdisk?
> Version? I'm not able to reproduce this problem (v2.28.2 as well as
> upstream tree with incoming v2.30).
root@sysresccd /mnt % sfdisk /dev/sdb < henwar.2017.sdb.sfdisk
Checking that no-one is using this disk right now ... OK

Disk /dev/sdb: 489.1 GiB, 525112713216 bytes, 1025610768 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

 >>> Script header accepted.
 >>> Script header accepted.
 >>> Script header accepted.
 >>> Script header accepted.
 >>> Created a new DOS disklabel with disk identifier 0x1f257e1a.
Created a new partition 1 of type 'W95 FAT32 (LBA)' and of size 500 MiB.
/dev/sdb2: Created a new partition 2 of type 'HPFS/NTFS/exFAT' and of 
size 488.6 GiB.
/dev/sdb3:
New situation:

Device     Boot   Start        End    Sectors   Size Id Type
/dev/sdb1  *       2048    1026047    1024000   500M  c W95 FAT32 (LBA)
/dev/sdb2       1026048 1025607679 1024581632 488.6G  7 HPFS/NTFS/exFAT

The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

root@sysresccd /mnt % sfdisk -d /dev/sdb
label: dos
label-id: 0x1f257e1a
device: /dev/sdb
unit: sectors

/dev/sdb1 : start=        2048, size=     1024000, type=c, bootable
/dev/sdb2 : start=     1026048, size=  1024581632, type=7

root@sysresccd /mnt % less henwar.2017.sdb.sfdisk
label: dos
label-id: 0x908b462c
device: /dev/sdb
unit: sectors

/dev/sdb1 : start=        2048, size=     1024000, type=c, bootable
/dev/sdb2 : start=     1026048, size=  1024581632, type=7

root@sysresccd /mnt % sfdisk -v
sfdisk from util-linux 2.28.2

As you see sfdisk creates different label-id than it has in file

>      
>         Karel
>
>
> # modprobe scsi_debug dev_size_mb=100;
> # echo ',,L' | sfdisk  /dev/sdc
>
>          Disk /dev/sdc: 100 MiB, 104857600 bytes, 204800 sectors
>          Units: sectors of 1 * 512 = 512 bytes
>          Sector size (logical/physical): 512 bytes / 512 bytes
>          I/O size (minimum/optimal): 512 bytes / 524288 bytes
>
>          >>> Created a new DOS disklabel with disk identifier 0x6061f502.
>          Created a new partition 1 of type 'Linux' and of size 99 MiB.
>          /dev/sdc2:
>          New situation:
>
>          Device     Boot Start    End Sectors Size Id Type
>          /dev/sdc1        2048 204799  202752  99M 83 Linux
>
> # sfdisk -d /dev/sdc > saved
> # cat saved
>
>          label: dos
>          label-id: 0x6061f502
>          device: /dev/sdc
>          unit: sectors
>
>          /dev/sdc1 : start=        2048, size=      202752, type=83
>
>
> # sfdisk  /dev/sdc < saved
>
>          Disk /dev/sdc: 100 MiB, 104857600 bytes, 204800 sectors
>          Units: sectors of 1 * 512 = 512 bytes
>          Sector size (logical/physical): 512 bytes / 512 bytes
>          I/O size (minimum/optimal): 512 bytes / 524288 bytes
>          Disklabel type: dos
>          Disk identifier: 0x6061f502
>
>          Old situation:
>
>          Device     Boot Start    End Sectors Size Id Type
>          /dev/sdc1        2048 204799  202752  99M 83 Linux
>
>          >>> Script header accepted.
>          >>> Script header accepted.
>          >>> Script header accepted.
>          >>> Script header accepted.
>          >>> Created a new DOS disklabel with disk identifier 0x6061f502.
>          Created a new partition 1 of type 'Linux' and of size 99 MiB.
>          /dev/sdc2:
>          New situation:
>
>          Device     Boot Start    End Sectors Size Id Type
>          /dev/sdc1        2048 204799  202752  99M 83 Linux
>
> # sfdisk -d /dev/sdc
>
>          label: dos
>          label-id: 0x6061f502
>          device: /dev/sdc
>          unit: sectors
>
>          /dev/sdc1 : start=        2048, size=      202752, type=83
>
>
>> Best Regards
>>
>> -- 
>> Bartłomiej Solarz-Niesłuchowski, Administrator WSISiZ
>> e-mail: Bartlomiej.Solarz-Niesluchowski@wit.edu.pl
>> tel. 223486547, fax 223486501
>> JID: solarz@jabber.wit.edu.pl
>> 01-447 Warszawa, ul. Newelska 6, pokój 404, pon.-pt. 8-16
>> Motto - Jak sobie pościelisz tak sie wyśpisz
>>
>>
>
>


-- 
Bartłomiej Solarz-Niesłuchowski, Administrator WSISiZ
e-mail: Bartlomiej.Solarz-Niesluchowski@wit.edu.pl
tel. 223486547, fax 223486501
JID: solarz@jabber.wit.edu.pl
01-447 Warszawa, ul. Newelska 6, pokój 404, pon.-pt. 8-16
Motto - Jak sobie pościelisz tak sie wyśpisz



[-- Attachment #2: Kryptograficzna sygnatura S/MIME --]
[-- Type: application/pkcs7-signature, Size: 3940 bytes --]

  reply	other threads:[~2017-02-21 16:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-21 16:31 label-id and sfdisk problem Bartłomiej Solarz-Niesłuchowski
2017-02-21 16:49 ` Karel Zak
2017-02-21 16:58   ` Bartłomiej Solarz-Niesłuchowski [this message]
2017-02-21 17:54     ` Bartłomiej Solarz-Niesłuchowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=64bb45d8-dfe2-caf2-e451-2009302d0932@wit.edu.pl \
    --to=bartlomiej.solarz-niesluchowski@wit.edu.pl \
    --cc=kzak@redhat.com \
    --cc=lukasz@trabinski.net \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.