clonezilla
clonezilla copied to clipboard
Feature request: Clone the partition attributes, too
To make the automatic deployment, there are some scenarios adding the partition attributes as the mark / information. For example, the attribute "GUID:55" of the 3rd partition:
$ fdisk -x eos-master-amd64-amd64.230319-231635.base.img
Disk eos-master-amd64-amd64.230319-231635.base.img: 10.64 GiB, 11428855808 bytes, 22321984 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
Disklabel type: gpt
Disk identifier: 5DD07621-DCEE-8C48-9C11-7393C662D5CA
First usable LBA: 2048
Last usable LBA: 22321950
Alternative LBA: 22321983
Partition entries starting LBA: 2
Allocated partition entries: 128
Partition entries ending LBA: 33
Device Start End Sectors Type-UUID UUID Name Attrs
eos-master-amd64-amd64.230319-231635.base.img1 2048 129023 126976 C12A7328-F81F-11D2-BA4B-00A0C93EC93B A06F549C-077C-8043-9CD2-644465F3B891
eos-master-amd64-amd64.230319-231635.base.img2 129024 131071 2048 21686148-6449-6E6F-744E-656564454649 FAD1B90D-16A1-E944-B56A-E01321F03FEF
eos-master-amd64-amd64.230319-231635.base.img3 131072 22321950 22190879 4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709 CF911273-9A0E-074E-A8E4-EDB3B48D215A GUID:55
However, current Clonezilla does not clone the attributes. It will be great to have this feature in Clonezilla.
The partition's attribute can be gotten and set with sfdisk:
$ sfdisk -l --part-attrs eos-master-amd64-amd64.230319-231635.base.img 3
GUID:55
Do you know any tool on GNU/Linux can save and restore all the attributes of all partitions? If there is, then this implementation will be very easy. Of course, we can write a script to do that for each partition...
Steven
Do you know any tool on GNU/Linux can save and restore all the attributes of all partitions?
The partition's attribute can be gotten and set with
sfdisk
I too have used sfdisk for saving and restoring partition attributes (maybe parted may also have that feature but have not tried)
I simply use sfdisk ...
Sure. Just want to make sure. So you both just use sfdisk to deal with every partition. There is no any option of sfdisk we can use to clone all attributes of all partitions?
Steven
There is no any option of sfdisk we can use to clone all attributes of all partitions?
Not that I am aware of...
sfdisk --part-attrs requires a partition number.
sfdisk --dump and sfdisk --json will dump all partitions details
This demonstrates various usages:
$ dd if=/dev/zero of=vdd.img bs=1M count=32
32+0 records in
32+0 records out
33554432 bytes (34 MB, 32 MiB) copied, 0.0597103 s, 562 MB/s
$ echo -e 'label:gpt\n,8M,U\n,,L\n' | sfdisk vdd.img
Checking that no-one is using this disk right now ... OK
Disk vdd.img: 32 MiB, 33554432 bytes, 65536 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.
>>> Created a new GPT disklabel (GUID: E223D002-4DBF-1C43-99E4-F84C6CBF6990).
vdd.img1: Created a new partition 1 of type 'EFI System' and of size 8 MiB.
vdd.img2: Created a new partition 2 of type 'Linux filesystem' and of size 23 MiB.
vdd.img3: Done.
New situation:
Disklabel type: gpt
Disk identifier: E223D002-4DBF-1C43-99E4-F84C6CBF6990
Device Start End Sectors Size Type
vdd.img1 2048 18431 16384 8M EFI System
vdd.img2 18432 65502 47071 23M Linux filesystem
The partition table has been altered.
Syncing disks.
$ sfdisk --dump vdd.img
label: gpt
label-id: E223D002-4DBF-1C43-99E4-F84C6CBF6990
device: vdd.img
unit: sectors
first-lba: 2048
last-lba: 65502
sector-size: 512
vdd.img1 : start= 2048, size= 16384, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, uuid=3BCF8A4E-0612-4942-B66A-1537720C502D
vdd.img2 : start= 18432, size= 47071, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=AE930EE6-BA01-BB46-9C53-6D46BC807AA7
sfdisk --json vdd.img
{
"partitiontable": {
"label":"gpt",
"id":"E223D002-4DBF-1C43-99E4-F84C6CBF6990",
"device":"vdd.img",
"unit":"sectors",
"firstlba":2048,
"lastlba":65502,
"sectorsize":512,
"partitions": [
{"node":"vdd.img1", "start":2048, "size":16384, "type":"C12A7328-F81F-11D2-BA4B-00A0C93EC93B", "uuid":"3BCF8A4E-0612-4942-B66A-1537720C502D"},
{"node":"vdd.img2", "start":18432, "size":47071, "type":"0FC63DAF-8483-4772-8E79-3D69D8477DE4", "uuid":"AE930EE6-BA01-BB46-9C53-6D46BC807AA7"}
]
}
}
$ sfdisk --part-attrs ./vdd.img 1
$ sfdisk --part-attrs ./vdd.img 2
$ sfdisk --part-attrs ./vdd.img 1 50
The partition table has been altered.
Syncing disks.
$ sfdisk --part-attrs ./vdd.img 2 60
The partition table has been altered.
Syncing disks.
$ sfdisk --part-attrs ./vdd.img 1
GUID:50
$ sfdisk --part-attrs ./vdd.img 2
GUID:60
$ sfdisk --dump vdd.img
label: gpt
label-id: E223D002-4DBF-1C43-99E4-F84C6CBF6990
device: vdd.img
unit: sectors
first-lba: 2048
last-lba: 65502
sector-size: 512
vdd.img1 : start= 2048, size= 16384, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, uuid=3BCF8A4E-0612-4942-B66A-1537720C502D, attrs="GUID:50"
vdd.img2 : start= 18432, size= 47071, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=AE930EE6-BA01-BB46-9C53-6D46BC807AA7, attrs="GUID:60"
$ sfdisk --json vdd.img
{
"partitiontable": {
"label":"gpt",
"id":"E223D002-4DBF-1C43-99E4-F84C6CBF6990",
"device":"vdd.img",
"unit":"sectors",
"firstlba":2048,
"lastlba":65502,
"sectorsize":512,
"partitions": [
{"node":"vdd.img1", "start":2048, "size":16384, "type":"C12A7328-F81F-11D2-BA4B-00A0C93EC93B", "uuid":"3BCF8A4E-0612-4942-B66A-1537720C502D", "attrs":"GUID:50"},
{"node":"vdd.img2", "start":18432, "size":47071, "type":"0FC63DAF-8483-4772-8E79-3D69D8477DE4", "uuid":"AE930EE6-BA01-BB46-9C53-6D46BC807AA7", "attrs":"GUID:60"}
]
}
}
$ sfdisk --part-attrs ./vdd.img 1 ""
The partition table has been altered.
Syncing disks.
$ sfdisk --part-attrs ./vdd.img 2 ""
The partition table has been altered.
Syncing disks.
$ sfdisk --dump vdd.img
label: gpt
label-id: E223D002-4DBF-1C43-99E4-F84C6CBF6990
device: vdd.img
unit: sectors
first-lba: 2048
last-lba: 65502
sector-size: 512
vdd.img1 : start= 2048, size= 16384, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, uuid=3BCF8A4E-0612-4942-B66A-1537720C502D
vdd.img2 : start= 18432, size= 47071, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=AE930EE6-BA01-BB46-9C53-6D46BC807AA7
$ sfdisk --json vdd.img
{
"partitiontable": {
"label":"gpt",
"id":"E223D002-4DBF-1C43-99E4-F84C6CBF6990",
"device":"vdd.img",
"unit":"sectors",
"firstlba":2048,
"lastlba":65502,
"sectorsize":512,
"partitions": [
{"node":"vdd.img1", "start":2048, "size":16384, "type":"C12A7328-F81F-11D2-BA4B-00A0C93EC93B", "uuid":"3BCF8A4E-0612-4942-B66A-1537720C502D"},
{"node":"vdd.img2", "start":18432, "size":47071, "type":"0FC63DAF-8483-4772-8E79-3D69D8477DE4", "uuid":"AE930EE6-BA01-BB46-9C53-6D46BC807AA7"}
]
}
}
I usually do something like: sudo sfdisk --part-attrs /dev/sdX 2 60