This file is indexed.

/usr/sbin/ocs-clean-part-fs is in clonezilla 3.27.16-2.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
# License: GPL 
# Author: Steven Shiau <steven _at_ clonezilla org>
# Description: Program to clean the file system/LVM info in every partition on the assigned disk.
# This program is used before writing partition table, to clean every
# file system and LV info in every partition. Otherwise, when partition
# table is created, the residual info, like LVM might be detected by
# kernel and instantly enabled. This will make some device is busy.
# Ref: https://sourceforge.net/p/clonezilla/bugs/254/

#
DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/usr/share/drbl}"
. $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions
. /etc/drbl/drbl-ocs.conf
. $DRBL_SCRIPT_PATH/sbin/ocs-functions

# Load the config in ocs-live.conf. This is specially for Clonezilla live. It will overwrite some settings of /etc/drbl/drbl-ocs.conf, such as $DIA...
[ -e "/etc/ocs/ocs-live.conf" ] && . /etc/ocs/ocs-live.conf

# Functions
USAGE() {
    echo "$ocs - To clean the file system/LVM info in every partition on the assigned disk."
    echo "Usage:"
    echo "To run $ocs:"
    echo "$ocs [OPTION] DEVICE"
    echo "DEVICE is the disk device name, e.g. /dev/sda, /dev/sdb..."
    echo "Ex:"
    echo "To check the image \"my-image\", which is located in $ocsroot/my-image, run"
    echo "To clean the file system/LVM info in every partition on disk /dev/sdg, run"
    echo "   $ocs /dev/sdg"
    echo
} # end of USAGE

####################
### Main program ###
####################

ocs_file="$0"
ocs=`basename $ocs_file`
#
while [ $# -gt 0 ]; do
 case "$1" in
   -*)     echo "${0}: ${1}: invalid option" >&2
           USAGE >& 2
           exit 2 ;;
   *)      break ;;
 esac
done

dev_clean="$1" # like /dev/sdg
if [ -z "$dev_clean" ]; then
  [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
  echo "No destination disk is assigned."
  [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
  echo "$msg_program_stop!"
  my_ocs_exit 1
fi

dev_clean_name="${dev_clean#/dev/*}"  # like sdg

BACKUP_DEVS=""
# Return the available partitions on disk in variable $BACKUP_DEVS
get_known_partition_proc_format $dev_clean_name all

# Check if PV of LVM is listed in the BACKUP_DEVS. If so, stop LVM first.
pv_dev="$(LC_ALL=C pvs --noheadings | awk -F" " '{print $1}')" # results e.g. /dev/sdg1 /dev/sdg2
for ip in $pv_dev; do
  if [ -n "$(echo $BACKUP_DEVS | grep -Ew "${ip#/dev/*}")" ]; then
     ocs-lvm2-stop
     break
  fi
done

for ipart in $BACKUP_DEVS; do
  clean_filesystem_header_in_partition /dev/$ipart
done

exit 0