mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-18 16:56:32 +00:00
Option for trimming ext partitions on raw images
Changelog-entry: Option for trimming ext partitions on raw images Change-type: patch
This commit is contained in:
parent
da548f59d1
commit
52a3258814
@ -37,6 +37,7 @@ const DEFAULT_SETTINGS = {
|
|||||||
errorReporting: true,
|
errorReporting: true,
|
||||||
unmountOnSuccess: true,
|
unmountOnSuccess: true,
|
||||||
validateWriteOnSuccess: true,
|
validateWriteOnSuccess: true,
|
||||||
|
trim: false,
|
||||||
updatesEnabled: packageJSON.updates.enabled && !_.includes([ 'rpm', 'deb' ], packageJSON.packageType),
|
updatesEnabled: packageJSON.updates.enabled && !_.includes([ 'rpm', 'deb' ], packageJSON.packageType),
|
||||||
lastSleptUpdateNotifier: null,
|
lastSleptUpdateNotifier: null,
|
||||||
lastSleptUpdateNotifierVersion: null,
|
lastSleptUpdateNotifierVersion: null,
|
||||||
|
@ -172,7 +172,8 @@ exports.performWrite = (image, drives, onProgress) => {
|
|||||||
uuid: flashState.getFlashUuid(),
|
uuid: flashState.getFlashUuid(),
|
||||||
flashInstanceUuid: flashState.getFlashUuid(),
|
flashInstanceUuid: flashState.getFlashUuid(),
|
||||||
unmountOnSuccess: settings.get('unmountOnSuccess'),
|
unmountOnSuccess: settings.get('unmountOnSuccess'),
|
||||||
validateWriteOnSuccess: settings.get('validateWriteOnSuccess')
|
validateWriteOnSuccess: settings.get('validateWriteOnSuccess'),
|
||||||
|
trim: settings.get('trim')
|
||||||
}
|
}
|
||||||
|
|
||||||
ipc.server.on('fail', ({ device, error }) => {
|
ipc.server.on('fail', ({ device, error }) => {
|
||||||
@ -200,6 +201,7 @@ exports.performWrite = (image, drives, onProgress) => {
|
|||||||
imagePath: image,
|
imagePath: image,
|
||||||
destinations: drives,
|
destinations: drives,
|
||||||
validateWriteOnSuccess: settings.get('validateWriteOnSuccess'),
|
validateWriteOnSuccess: settings.get('validateWriteOnSuccess'),
|
||||||
|
trim: settings.get('trim'),
|
||||||
unmountOnSuccess: settings.get('unmountOnSuccess')
|
unmountOnSuccess: settings.get('unmountOnSuccess')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -312,6 +314,7 @@ exports.flash = (image, drives) => {
|
|||||||
flashInstanceUuid: flashState.getFlashUuid(),
|
flashInstanceUuid: flashState.getFlashUuid(),
|
||||||
unmountOnSuccess: settings.get('unmountOnSuccess'),
|
unmountOnSuccess: settings.get('unmountOnSuccess'),
|
||||||
validateWriteOnSuccess: settings.get('validateWriteOnSuccess'),
|
validateWriteOnSuccess: settings.get('validateWriteOnSuccess'),
|
||||||
|
trim: settings.get('trim'),
|
||||||
applicationSessionUuid: store.getState().toJS().applicationSessionUuid,
|
applicationSessionUuid: store.getState().toJS().applicationSessionUuid,
|
||||||
flashingWorkflowUuid: store.getState().toJS().flashingWorkflowUuid
|
flashingWorkflowUuid: store.getState().toJS().flashingWorkflowUuid
|
||||||
}
|
}
|
||||||
@ -375,6 +378,7 @@ exports.cancel = () => {
|
|||||||
flashInstanceUuid: flashState.getFlashUuid(),
|
flashInstanceUuid: flashState.getFlashUuid(),
|
||||||
unmountOnSuccess: settings.get('unmountOnSuccess'),
|
unmountOnSuccess: settings.get('unmountOnSuccess'),
|
||||||
validateWriteOnSuccess: settings.get('validateWriteOnSuccess'),
|
validateWriteOnSuccess: settings.get('validateWriteOnSuccess'),
|
||||||
|
trim: settings.get('trim'),
|
||||||
applicationSessionUuid: store.getState().toJS().applicationSessionUuid,
|
applicationSessionUuid: store.getState().toJS().applicationSessionUuid,
|
||||||
flashingWorkflowUuid: store.getState().toJS().flashingWorkflowUuid,
|
flashingWorkflowUuid: store.getState().toJS().flashingWorkflowUuid,
|
||||||
status: 'cancel'
|
status: 'cancel'
|
||||||
|
@ -43,6 +43,17 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="checkbox">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox"
|
||||||
|
tabindex="8"
|
||||||
|
ng-model="settings.currentData.trim"
|
||||||
|
ng-change="settings.toggle('trim')">
|
||||||
|
|
||||||
|
<span>Trim ext{2,3,4} partitions before writing (raw images only)</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox"
|
<input type="checkbox"
|
||||||
|
@ -93,6 +93,7 @@ const handleError = async (error) => {
|
|||||||
* @param {SourceDestination} source - source
|
* @param {SourceDestination} source - source
|
||||||
* @param {SourceDestination[]} destinations - destinations
|
* @param {SourceDestination[]} destinations - destinations
|
||||||
* @param {Boolean} verify - whether to validate the writes or not
|
* @param {Boolean} verify - whether to validate the writes or not
|
||||||
|
* @param {Boolean} trim - whether to trim ext partitions before writing
|
||||||
* @param {Function} onProgress - function to call on progress
|
* @param {Function} onProgress - function to call on progress
|
||||||
* @param {Function} onFail - function to call on fail
|
* @param {Function} onFail - function to call on fail
|
||||||
* @returns {Promise<{ bytesWritten, devices, errors} >}
|
* @returns {Promise<{ bytesWritten, devices, errors} >}
|
||||||
@ -100,8 +101,17 @@ const handleError = async (error) => {
|
|||||||
* @example
|
* @example
|
||||||
* writeAndValidate(source, destinations, verify, onProgress, onFail, onFinish, onError)
|
* writeAndValidate(source, destinations, verify, onProgress, onFail, onFinish, onError)
|
||||||
*/
|
*/
|
||||||
const writeAndValidate = async (source, destinations, verify, onProgress, onFail) => {
|
const writeAndValidate = async (source, destinations, verify, trim, onProgress, onFail) => {
|
||||||
const innerSource = await source.getInnerSource()
|
let innerSource = await source.getInnerSource()
|
||||||
|
if (trim && (await innerSource.canRead())) {
|
||||||
|
innerSource = new sdk.sourceDestination.ConfiguredSource(
|
||||||
|
innerSource,
|
||||||
|
trim,
|
||||||
|
|
||||||
|
// Create stream from file-disk (not source stream)
|
||||||
|
true
|
||||||
|
)
|
||||||
|
}
|
||||||
const { failures, bytesWritten } = await sdk.multiWrite.pipeSourceToDestinations(
|
const { failures, bytesWritten } = await sdk.multiWrite.pipeSourceToDestinations(
|
||||||
innerSource,
|
innerSource,
|
||||||
destinations,
|
destinations,
|
||||||
@ -197,6 +207,7 @@ ipc.connectTo(IPC_SERVER_ID, () => {
|
|||||||
log(`Devices: ${destinations.join(', ')}`)
|
log(`Devices: ${destinations.join(', ')}`)
|
||||||
log(`Umount on success: ${options.unmountOnSuccess}`)
|
log(`Umount on success: ${options.unmountOnSuccess}`)
|
||||||
log(`Validate on success: ${options.validateWriteOnSuccess}`)
|
log(`Validate on success: ${options.validateWriteOnSuccess}`)
|
||||||
|
log(`Trim: ${options.trim}`)
|
||||||
const dests = _.map(options.destinations, (destination) => {
|
const dests = _.map(options.destinations, (destination) => {
|
||||||
return new sdk.sourceDestination.BlockDevice(destination, options.unmountOnSuccess)
|
return new sdk.sourceDestination.BlockDevice(destination, options.unmountOnSuccess)
|
||||||
})
|
})
|
||||||
@ -206,6 +217,7 @@ ipc.connectTo(IPC_SERVER_ID, () => {
|
|||||||
source,
|
source,
|
||||||
dests,
|
dests,
|
||||||
options.validateWriteOnSuccess,
|
options.validateWriteOnSuccess,
|
||||||
|
options.trim,
|
||||||
onProgress,
|
onProgress,
|
||||||
onFail
|
onFail
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user