Menu

#299 wrong disk gets backed up

testing_clonezilla
open
nobody
None
5
2018-07-15
2018-05-29
Saige Losli
No

I am using clonezilla-live-20170905-zesty-amd64 to do a scripted backup. The command line I'm using for the backup is:
/usr/sbin/ocs-sr -batch -q2 -j2 -z1p -i 4096 -scs -p true savedisk autoname sdc

The problem is that occasionally, "sdc" is assigned to a different disk drive that I expected it to be, and it backs up the wrong disk.

Is there a way to force devices in the /dev directory to be consistent from session to session? I have a disk label on the ext2-formatted drive I want to backup, but I have not found a way to tell Clonezilla to use the label to assign it to "sdc". Or maybe there is another solution?

Discussion

  • Michal Zatloukal

    • Forcing devices to have persistent naming is probably possible via udev rules, but I'm not sure how and if it's possible to implement in a clonezilla environment without changing the filesystem image.
    • If you're running scripted, then figure out how you can universally identify the disk (attachment to specific storage port, label of a filesystem, vendor/model/serial #, etc.), and resolve the appropriate symlink under /dev/disk/by-...; currently, ocs-sr will not accept the symlink directly via argument, unfortunately.
     
  • Saige Losli

    Saige Losli - 2018-05-30

    I would love to associate the device with a filesystem label. But how to tell Clonezilla about it? Can I replace "sdc" with "disk/by-label/BACKUP-VOLUME"? Or something like that?

     
  • Michal Zatloukal

    You can't replace "sdc" with "disk/by-label/..." in the ocs-sr command's arguments. What script are you running when you execute clonezilla? Edit the relevant sections to do something like:

    DISK=$(basename $(readlink -m  /disk/by-label/DISK_TO_BACKUP))
    /usr/sbin/ocs-sr -batch -q2 -j2 -z1p -i 4096 -scs -p true savedisk autoname $DISK
    

    The by-label will catch only the volume (eg. sdc2), so if you want to backup the whole disk, do this:

    DISK=$(basename $(readlink -m  /disk/by-label/DISK_TO_BACKUP))
    /usr/sbin/ocs-sr -batch -q2 -j2 -z1p -i 4096 -scs -p true savedisk autoname ${DISK/[[:digit:]]/}
    
     
    • Saige Losli

      Saige Losli - 2018-06-07

      Thank you, Michal Zatloukal, for this very insightful suggestion. You have obviously encountered this exact problem before and have identified a very good solution. I am happy that Steven Shiau is looking at the issue and may be able to create a more straighforward method for solving this problem in the future. But your suggest has helped me very much. Thank you.

      --Saige

       
  • Steven Shiau

    Steven Shiau - 2018-06-03

    For the time being, there are two reserved words for the device name, i.e.,
    "ask_user" and "all".
    "ask_user" allows you to select the source disk name, wile "all" will automatically put the available disk name detected on the system as the source disks. In the future, if you have a good rule to select a device (like some kind of UUID which can be detected on the system then converted to device name), then we can implement that.
    Thanks.

    Steven

     
  • Saige Losli

    Saige Losli - 2018-06-07

    Thanks for looking at this, Steven,

    I'm primarily a Linux user, so I don't know how well this would work for Windows users. But my thought would be to allow values in the device name field like the following:

    • sda
    • ask_user
    • all
    • LABEL="some label"
    • UUID="123-456-789-etc"

    I think my LABEL and UUID suggestions are practically a carbon copy of the LABEL and UUID options for the mount command on my Linux distribution.

    For the record, the suggestion made by Michal Zatloukal above, seems to be working well for me at this point. But it is not immediately apparent to the un-trained eye that this possibility exists. So an option to directly support LABEL and UUID would be welcomed.

    Thanks for your consideration,

    --Saige

     
  • Steven Shiau

    Steven Shiau - 2018-07-15

    Saige,
    Thanks for your suggestion. The key is actually that UUID and Label is for partition or file system, not for disk. Therefore we should have a way to implement that for disk device.

    Steven

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.