ocs-sr: replace DEVICENAME with UUID?
A partition and disk imaging/cloning program
Brought to you by:
steven_shiau
hi.
custom-ocs:
/usr/sbin/ocs-sr -q2 -c -j2 -z1p -i 4096 -fsck -senc -p reboot savedisk sda_$(date +"%y%m%d-%H%M").img sda
does not find the 'right' sda every time,
sometimes a different disk is displayed.
it is possible to replace sda with the UUID, example:
/usr/sbin/ocs-sr -q2 -c -j2 -z1p -i 4096 -fsck -senc -p reboot savedisk sda_$(date +"%y%m%d-%H%M").img UUID=abe00c18-bbb5-458a-907d-06cb249cc987
thank you!
UUID does not work because it is partition related.
How do I get it to always get the 'right' sda?
one possibility would be scsi@0:0.0.0, could that be implemented?
example:
/usr/sbin/ocs-sr -q2 -c -j2 -z1p -i 4096 -fsck -senc -p reboot savedisk sda_$(date +"%y%m%d-%H%M").img scsi@0:0.0.0
Right, it's the problem.
UUID is only for file system, so it won't work.
PTUUID is one of the possibility to choose. However, the issue is when the destination disk is bare device, no any partition table on that, then no destination can be chosen. Hence it's possible to assign PTUUID for saving mode, but not for restoring mode.
Steven
partition table UUID would also be fine with me, I only care about the backup of my complete sda
sudo blkid /dev/sda:
/dev/sda: PTUUID="f3480c78-c548-4b4b-b221-0f860b0a5442" PTTYPE="gpt"
/usr/sbin/ocs-sr -q2 -c -j2 -z1p -i 4096 -fsck -senc -p reboot savedisk sda_$(date +"%y%m%d-%H%M").img PTUUID="f3480c78-c548-4b4b-b221-0f860b0a5442"
would be fine
Last edit: LinuxOpa 2020-11-09
Sure. Will try to add this feature in the future release.
Steven
Thank you very much!
Please give testing Clonezilla live >= 2.7.0-16 or 20201118-* a try:
https://clonezilla.org/downloads.php
When ocs-sr is in saving mode, the DEVICE name can also be assigned by:
For disk: PTUUID or SERIALNO, e.g.,
PTUUID=03c8b280-47aa-4881-aca5-9b9c66fe28c7.
If there are spaces in SERIALNO, replace every space by "_".
For partition: UUID or PARTUUID,
e.g., UUID=0b51ce79-7bc0-4111-8a40-839461a9b12f"
E.g.,
/usr/sbin/ocs-sr -q2 -c -j2 -z9p -i 4096 -sfsck -senc -p choose savedisk 2020-11-16-13-img SERIALNO=36000c292124c4d6554f924089bd9b83a serialno=36000c29045c0eab7f80c902114867c19 PTUUID="f722833a"
ok, tested:
/usr/sbin/ocs-sr -q2 -c -j2 -z1p -i 4096 -fsck -senc -p reboot savedisk sda_$(date +"%y%m%d-%H%M").img SERIALNO=WD-WCC1U2380486
--->"input device not found"
no spaces in SERIALNO
/usr/sbin/ocs-sr -q2 -c -j2 -z1p -i 4096 -fsck -senc -p reboot savedisk sda_$(date +"%y%m%d-%H%M").img PTUUID=f3480c78-c548-4b4b-b221-0f860b0a5442
--->has found the device, it is the right one, but is named sdb instead of sda
sudo smartctl -i /dev/sda
=== START OF INFORMATION SECTION ===
Model Family: Western Digital AV-GP (AF)
Device Model: WDC WD10EURX-63FH1Y0
Serial Number: WD-WCC1U2380486
LU WWN Device Id: 5 0014ee 25d8e232a
Firmware Version: 01.01A01
User Capacity: 1.000.204.886.016 bytes [1,00 TB]
Sector Sizes: 512 bytes logical, 4096 bytes physical
Device is: In smartctl database [for details use: -P show]
ATA Version is: ATA8-ACS (minor revision not indicated)
SATA Version is: SATA 3.0, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is: Wed Nov 18 21:43:04 2020 CET
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
sudo blkid /dev/sda
/dev/sda: PTUUID="f3480c78-c548-4b4b-b221-0f860b0a5442" PTTYPE="gpt"
Interesting... Which Clonezilla live file did you download and try?
Steven
2.7.0-16
AMD64 version of? I'd like to focus on the one you tested so please give precise file name you have.
Steven
clonezilla-live-2.7.0-16-amd64.iso
OK, thanks.
BTW, I need more info you have there, so please boot Clonezilla live 2.7.0-16 amd64 on the machine, then:
1. sudo -i
2. blkid
3. blkid /dev/sda /dev/sdb
4. ocs-get-dev-info /dev/sda serialno
5. ocs-get-dev-info /dev/sdb serialno
Please post the results of (2)-(5).
Thanks.
Steven
ok, this evening, (timezone utc+1)
sudo -i
done
blkid
/dev/loop0: TYPE="squashfs"
/dev/sda1: UUID="5a0961aa-8943-4aa4-9972-2ae2e755b9d6" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="cf2dbd0a-3b9c-418a-b53c-91e8369a92b0"
/dev/sda2: UUID="2028-C27E" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="0731cb5a-c3c2-41dd-a86b-e4977b6a063e"
/dev/sdc1: UUID="abe00c18-bbb5-458a-907d-06cb249cc938" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="4b5e44ca-01"
/dev/sdb5: UUID="a002a27c-f6b1-4ea2-a757-234019ae9808" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="173d9e6c-05"
/dev/sdb6: UUID="a2d94146-cda5-4e06-a0b8-925c81fa09b1" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="173d9e6c-06"
/dev/sdd1: LABEL="ventoy" UUID="77E7-E3D7" BLOCK_SIZE="512" TYPE="exfat" PTTYPE="dos" PARTUUID="580e6fa2-01"
/dev/dm-0: BLOCK_SIZE="2048" UUID="2020-11-18-19-52-31-00" LABEL="2.7.0-16-amd64" TYPE="iso9660"
blkid /dev/sda /dev/sdb
/dev/sda: PTUUID="f3480c78-c548-4b4b-b221-0f860b0a5442" PTTYPE="gpt" (1. Drive, Boot, , '/', 1GB)
/dev/sdb: PTUUID="173d9e6c" PTTYPE="dos" (2. Drive, '/home/', '/daten', 2GB)
ocs-get-dev-info /dev/sda serialno
WDC_WD10EURX-63FH1Y0_WD-WCC1U2380486
ocs-get-dev-info /dev/sdb serialno
ST32000645NS_Z1K0QC0G
'your' serialno is a combination:
Device Model: WDC WD10EURX-63FH1Y0
Serial Number: WD-WCC1U2380486
see here
https://sourceforge.net/p/clonezilla/support-requests/143/#fe88
may be the reason?
by the way:
now it was /dev/sda again; where does only this back and forth sda sdb come from...
"'your' serialno is a combination" -> Bingo... So I did not find that because I tested that on a virtual machine. OK, I will fix it asap.
" now it was /dev/sda again; where does only this back and forth sda sdb come from..." -> So you meant without rebooting, this back and forth sda sdb happens?
Steven
no, no recognizable mechanism between reboots. but the correct source-drive was recognized, the naming sd(whatelse) is not interesting for me because it is fixed by the serialno (in future) / ptuuid.
OK, we have fixed the serialno syntax. Please give Clonezilla live >= 2.7.0-18 or 20201124-* a try:
https://clonezilla.org/downloads.php
now something like serialno=02000000000000000001 should work for both source and destination disk.
Actually before we used the serial no got from udevadm, e.g.,
# udevadm info -q env -n /dev/sda |grep ID_SERIAL
ID_SERIAL=VMware_Virtual_SATA_Hard_Drive_02000000000000000001 ID_SERIAL_SHORT=02000000000000000001
Yes, I agree it's better to use the short one.
Steven
Last edit: Steven Shiau 2020-11-25
ok, later today, it's now 02:00 am utc+1
both versions
/usr/sbin/ocs-sr -q2 -c -j2 -z1p -i 4096 -fsck -senc -p reboot savedisk \
sda_$(date +"%y%m%d-%H%M").img PTUUID=f3480c78-c548-4b4b-b221-0f860b0a5442
and
/usr/sbin/ocs-sr -q2 -c -j2 -z1p -i 4096 -fsck -senc -p reboot savedisk \
sda_$(date +"%y%m%d-%H%M").img PTUUID=f3480c78-c548-4b4b-b221-0f860b0a5442 SERIALNO=WD-WCC1U2380486
work perfectly
THANK YOU again for the customizations!
Great! Thanks for your confirmation.
Steven
Hi, thanks for this great work! This was exactly what I needed.
When will you release the serialno-feature?
Thanks a lot, for Clonezilla!
I think we have finalized this feature, so if this testing version works for you, please use it.
Normally we release a stable release every two to three months. Of course, if the testing one works well and receive good feedback, we can promote it to stable one earlier.
Thanks.
Steven
what irritates me (but does not affect the function) is that sometimes the sda is displayed as sdb, see screenshot.