File | Date | Author | Commit |
---|---|---|---|
.hgignore | 2019-01-11 |
![]() |
[a3cacd] First pass |
README.md | 2022-01-09 |
![]() |
[501569] Modified README |
README.pdf | 2022-01-06 |
![]() |
[0119b0] Remove extraneous comment. Added pdf doc and e... |
edit | 2022-01-06 |
![]() |
[0119b0] Remove extraneous comment. Added pdf doc and e... |
img-mount | 2019-01-12 |
![]() |
[5377dc] Added readme. |
img-umount | 2019-01-11 |
![]() |
[4235ee] img-umount done |
sd-save | 2019-01-18 |
![]() |
[048135] Add help to sd-save and sd-write |
sd-write | 2022-01-06 |
![]() |
[0119b0] Remove extraneous comment. Added pdf doc and e... |
This package contains 4 shell scripts. All shell scripts must be run using bash
and are not expected to work with other shells.
The purpose of these scripts is to allow disk image copies to and from SD cards so that copies of the SD cards may be saved lest the original card becomes corrupt, or to allow downloaded images (e.g. for installable operating systems) to be written to SD cards.
Although this is intended for use with SD cards, it should work as well with any removable block device (e.g. a DVD writer).
The 4 scripts are:
This will copy an image stored on the SD card to a file.
The command format is:
sd-save
options
The options are described in long form, but each of the options can be used with a single letter, thus the -input=
option can also be used as -i=
.
-help
Will display a help message.
-input=
source_device
source_device is the device name where the SD card is attached (e.g. sdc
).
Note that this has no path (e.g. /dev/sdc
would be wrong, it must be sdc,
and no individual partitions are allowed, so sdc1
would also be incorrect).
-output=
target_file
target_file is the name of the file to which the image is to be written.
If the file is written uncompressed then the file must have a .img
suffix. If the file is to be saved in compressed form then, depending on the type of compression, the file suffix must me either .img.gz
or .img.bz2
or .img.xz
.
-sparse
If this switch is included and the file is being saved in uncompressed form then the output will attempt to skip writing null data blocks and so improve its performance. This switch is ignored if the output file is a compressed file.
-trim
If this switch is included then data beyond the the end of last partition in the partition table will not be copied.
You may not use this switch for a source_device that does not contain partitions.
This will copy an image stored in a file to an SD card.
The command format is:
sd-write
options
The options are described in long form, but each of the options can be used with a single letter, thus the -input=
option can also be used as -i=
.
-input=
source_filesource_file is the name of the file to from which the image is to be read.
The file must have a suffix of .img
or .iso
or .img.gz
or .iso.gz
or .img.bz2
or .iso.bz2
or .img.xz
or .iso.xz
.
-output=
target_device
target_device is the device name where the SD card is attached (e.g. sdc
). This is where the image is to be written.
Note that this has no path (e.g. /dev/sdc
would be wrong, it must be sdc
, nor are separate partitions allowed, so sdc1
would also be incorrect).
Optionally, the output may be directed to the null
device, which might be useful for testing purposes where one does not actually wish to write to a physical device.
-sparse
If this switch is included and the file is being saved in uncompressed form then the output will attempt to skip writing null data blocks and so improve its performance.
This will mount a stored disk image (only uncompressed images may be used) on a mount point.
The command format is:
img-mount
image_file mount_point
image_file is the name of the file where the disk image is stored.
Optionally, if the image contains partitions, then image_file should be of the form image_file:
partition_number (e.g. test.img:1
). The partition_number starts with 1
as the first partition.
You may use the command fdisk -l
image_file to determine which partitions exist on the image.
mount_point is the directory where the image is to be mounted.
This will dismount a stored disk image from a mount point.
The command format is:
img-umount
mount_point
mount_point is the directory where the image was mounted.