Creating a dd disk Image

creating and setting it up will help you do a lot of things!

Download ChallengerOS

How to create and set up a dd disk Image

computer file copy
Table of Contents

Let's start by saing that dd stands for Disk Dumping, and that it is an exact clone of the image onto your device. dd flat copies the image byte by byte onto the device, starting at the first byte of the first sector, and continue to copy bytes until the data from the image is exhausted.

It usually ensures that you get an exact clone of the image or device the maintainer of the distro created. dd disk Images don't require partitioning or formatting, and it can create a copy of your device with file systems that your OS is unable to handle on its own.

cloning to a ssd memory to another by dd image

losetup is a command on Lunux operating systems, that is used to associate loop devices with regular files or block devices, to detach loop devices and to query the status of a loop device.

It is possible to specify transfer functions (for encryption/decryption or other purposes) using one of the -E and -eoptions. You can specify the encryption by two mechanisms: by number or by name. If an encryption is specified by number then one has to make sure that the Linux kernel knows about the encryption with that number, probably by patching the kernel.

The results of the losetup are as follows:

GNU ddrescue is a data recovery tool. It copies data from one file or block device (hard disc, cdrom, etc) to another, trying to rescue the good parts first in case of read errors in an intelligent manner to minimize data loss by scraping good sectors from partially read blocks.

GNU ddrescue logo
GNU ddrescue manual cover
command

response


locate yourself on a partition that has sufficient capacity

with the right mouse button open terminal

# ddrescue -s 10G /dev/zero diskimage.dsk

Note:

-s size in GB

/dev/zero source

diskimage.dsk disk image.dsk

run the losetup command to assign the disk image to the operating system

# losetup -f diskimage.dsk

locate the peripheral ID

# losetup -a | grep diskimage.dsk

example

/dev/loop107: [2065]: 3403701541 (/run/media/root/4eadc9db-842c-490b-a192-c3407bcdcab8/diskimage.dsk)

/dev/loop107is the virtual device

# gdisk /dev/loop107

create the GPT partitioning scheme

GPT fdisk (gdisk) version 1.0.0

Partition table scan: 
MBR: not present
BSD: not present
APM: not present
GPT: not present

Creating new GPT entries.

press "n" and return

Partition number (1-128, default 1):

press return

First sector (34-19531216, default=2048) or {+ -} size {KMGTP}:

press return

The current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter=8300):

press return

Changed type of partition to 'Linux filesystem'

press "w"

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS !!

Do you want to proceed? (Y/N):

press "Y"

OK; writing new GUID partition table (GPT) to / dev / loop107.
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot or after you
run partprobe (8) or kpartx (8)
The operation has been completed successfully.

Scan the device

# partprobe /dev/loop107

Format the primary partition

# mkfs.ext4 /dev/loop107p1
mke2fs 1.43.1 (08-Jun-2016)
Discarding device blocks: done
Creating filesystem with 2441146 4k blocks and 610800 inodes
Filesystem UUID: 4319b905-d9d9-4949-a2db-9751ea7be5d8
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

The new device is available on the system in read write mode.





If you find our content interesting, Join our Telegram Channel today!