Bin gerade dabei, ntfs-write-image zu testen.
habe die Standard ntfs-write-image.py benutzt.
Code: Alles auswählen
# Get first harddisk
disk = getHarddisks()[0]
# Show partition information
partitions = disk.getPartitions()
for p in partitions:
fs = p.get('fs', 'unbekannt')
type = p.get('type', 'unbekannt')
ui.getMessageBox().addText( "Partition %s: Start %s MB, Ende %s MB, Dateisystem %s , Typ %s.\n" \
% ( p['number'],
p['start']/(1000*1000),
p['end']/(1000*1000),
fs,
type) )
# Get partition number from config
partition = productProperties.get('partition')
if not partition:
# Partition not defined => ask user
values = ui.getValues( [ { 'name': 'Partitionsnummer', 'value': partition } ] )
if not values:
raise Exception(_('Canceled'))
partition = values[0]['value']
depotId = backend.getDepotId(fqdn)
depotIp = backend.getDepot_hash(depotId).get("ip", depotId)
depotBackend = JSONRPCBackend(address = depotIp, username = fqdn, password = pckey)
if not os.path.exists("/root/.ssh"):
mkdir("/root/.ssh")
os.chmod("/root/.ssh", 0700)
f = open("/root/.ssh/id_rsa", 'w')
f.write(depotBackend.getPcpatchRSAPrivateKey())
f.close()
os.chmod("/root/.ssh/id_rsa", 0600)
f = open("/root/.ssh/known_hosts", 'w')
f.write(depotIp + " " + depotBackend.getHostRSAPublicKey())
f.close()
os.chmod("/root/.ssh/known_hosts", 0600)
depotBackend.exit()
try:
execute("ssh -i /root/.ssh/id_rsa pcpatch@%s 'ls -ld %s'" \
% (depotIp, productProperties['imagedir']))
except Exception, e:
raise Exception("Failed to write image: %s" % e)
if productProperties['imagefile'].endswith('.gz'):
disk.saveImage( partition = int(partition),
imageFile = "| gzip -c | ssh -i /root/.ssh/id_rsa pcpatch@%s 'cat > %s/%s'" \
% (depotIp, productProperties['imagedir'], productProperties['imagefile']) )
else:
disk.saveImage( partition = int(partition),
imageFile = "| ssh -i /root/.ssh/id_rsa pcpatch@%s 'cat > %s/%s'" \
% (depotIp, productProperties['imagedir'], productProperties['imagefile']) )
# Set product installation status
backend.setProductInstallationStatus(productId, fqdn, 'not_installed')
# Reboot
reboot()
Code: Alles auswählen
Failed: ERRNO(32): Write failed: Broken pipe
Code: Alles auswählen
[6] [Jun 22 13:10:23] Using encoding 'UTF-8' (Posix.py|461)
[7] [Jun 22 13:10:24] >>> drwxr-sr-x 2 root pcpatch 4096 22. Jun 09:39 /var/lib/opsi/ntfs-images (Pos ix.py|501)
[7] [Jun 22 13:10:24] Exit code: 0 (Posix.py|508)
[7] [Jun 22 13:10:24] MessageSubject 'saveImage_progress' created (Message.py|111)
[7] [Jun 22 13:10:24] ProgressSubject 'saveImage_progress' created (Message.py|236)
[6] [Jun 22 13:10:24] Saving partition '/dev/sda3' to ntfsclone-image '-' (Posix.py|1491)
[7] [Jun 22 13:10:24] Command 'ntfsclone' found at: '/usr/sbin/ntfsclone' (Posix.py|412)
[6] [Jun 22 13:10:24] Executing: /usr/sbin/ntfsclone --save-image -f --overwrite - /dev/sda3 | gzip - c | ssh -i /root/.ssh/id_rsa pcpatch@192.168.40.214 'cat > /var/lib/opsi/ntfs-images/hp.img.gz' (Posi x.py|430)
[7] [Jun 22 13:10:24] -->>> ntfsclone v2.0.0 (libntfs 10:0:0) (Posix.py|1545)
[7] [Jun 22 13:10:24] -->>> NTFS volume version: 3.1 (Posix.py|1545)
[7] [Jun 22 13:10:24] -->>> Cluster size : 4096 bytes (Posix.py|1545)
[7] [Jun 22 13:10:24] -->>> Current volume size: 1050697728 bytes (1051 MB) (Posix.py|1545)
[7] [Jun 22 13:10:24] -->>> Current device size: 1050699776 bytes (1051 MB) (Posix.py|1545)
[6] [Jun 22 13:10:24] Save image: Scanning filesystem (Posix.py|1526)
[7] [Jun 22 13:10:24] -->>> Scanning volume ... (Posix.py|1545)
[7] [Jun 22 13:10:24] -->>> 39,22 percent completed (Posix.py|1541)
[7] [Jun 22 13:10:24] -->>> 78,43 percent completed (Posix.py|1541)
[7] [Jun 22 13:10:24] -->>> 100.00 percent completed (Posix.py|1545)
[7] [Jun 22 13:10:24] -->>> Accounting clusters ... (Posix.py|1545)
[7] [Jun 22 13:10:24] -->>> Space in use : 31 MB (2,9%) (Posix.py|1545)
[6] [Jun 22 13:10:24] Save image: Writing image (Posix.py|1530)
[7] [Jun 22 13:10:24] -->>> Saving NTFS to image ... (Posix.py|1545)
[7] [Jun 22 13:10:24] -->>> bash: /var/lib/opsi/ntfs-images/hp.img.gz: Keine Berechtigung (Posix.py| 1545)
[7] [Jun 22 13:10:24] -->>> (Posix.py|1545)
[7] [Jun 22 13:10:24] -->>> gzip: stdout: Broken pipe (Posix.py|1545)
[7] [Jun 22 13:10:24] -->>> ERROR(32): Write failed: Broken pipe (Posix.py|1545)
[2] [Jun 22 13:10:25] Traceback: (Logger.py|695)
[2] [Jun 22 13:10:25] line 1119 in '<module>' in file '/usr/local/bin/master.py' (Logger.py|695)
[2] [Jun 22 13:10:25] line 55 in '<module>' in file '/mnt/opsi/install/ntfs-write-image/ntfs-wri te-image.py' (Logger.py|695)
[2] [Jun 22 13:10:25] line 1565 in 'saveImage' in file '/usr/lib/pymodules/python2.6/OPSI/System /Posix.py' (Logger.py|695)
[2] [Jun 22 13:10:25] line 267 in 'error_Harddisk_saveImage' in file '/usr/local/bin/master.py' (Logger.py|695)
[2] [Jun 22 13:10:25] ==>>> Failed: ERROR(32): Write failed: Broken pipe (master.py|1167)
[7] [Jun 22 13:10:25] Backend: <OPSI.Backend.JSONRPC.JSONRPCBackend instance at 0x896fccc> (master.py |1170)
[7] [Jun 22 13:10:25] ProductId: ntfs-write-image (master.py|1171)
[7] [Jun 22 13:10:25] ClientId: hp-test.domain.local (master.py|1172)
[7] [Jun 22 13:10:25] ProductOnClient: None (master.py|1173)
[7] [Jun 22 13:10:25] Executing jsonrpc method 'unsetProductActionRequest' (JSONRPC.py|340)
[7] [Jun 22 13:10:25] Using method POST (JSONRPC.py|385)
[7] [Jun 22 13:10:25] Executing jsonrpc method 'setProductInstallationStatus' (JSONRPC.py|340)
[7] [Jun 22 13:10:25] Using method POST (JSONRPC.py|385)
[7] [Jun 22 13:10:28] Command 'umount' found at: '/bin/umount' (Posix.py|412)
[6] [Jun 22 13:10:28] Executing: /bin/umount /mnt/opsi (Posix.py|430)
[6] [Jun 22 13:10:28] Using encoding 'UTF-8' (Posix.py|461)
[7] [Jun 22 13:10:28] Exit code: 0 (Posix.py|508)
[5] [Jun 22 13:10:28] Writing log to service (master.py|1203)