Difference between revisions of "Dd"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
− | Create mount and | + | Create mount using mkfs.ext4 -F --force and sparse |
``` | ``` | ||
dd if=/dev/zero of=image.img iflag=fullblock bs=1M count=10 && sync | dd if=/dev/zero of=image.img iflag=fullblock bs=1M count=10 && sync | ||
Line 12: | Line 12: | ||
du -sh sparse.image.img | du -sh sparse.image.img | ||
du -sh image.img | du -sh image.img | ||
+ | ``` | ||
+ | |||
+ | # losetup | ||
+ | ``` | ||
+ | mkdir mymount1 mymount2 | ||
+ | dd if=/dev/zero of=image.img iflag=fullblock bs=1M count=10 && sync | ||
+ | sudo losetup --partscan --find --show image.img | ||
+ | sudo mkfs.ext2 /dev/yourloop24 | ||
+ | sudo mount /dev/loop24 ./mymount1/ | ||
+ | du -sh image.img | ||
+ | sudo chmod 0777 mymount1 | ||
+ | echo foo > mount/foo.txt | ||
+ | cp --sparse=always image.img image.img.sparse | ||
+ | du -sh image.img.sparse | ||
+ | sudo mount image.img.sparse ./mymount2 | ||
``` | ``` | ||
Revision as of 19:20, 2 December 2022
Create mount using mkfs.ext4 -F --force and sparse
dd if=/dev/zero of=image.img iflag=fullblock bs=1M count=10 && sync parted image.img print mkfs.ext4 -F image.img parted image.img print mkdir mntimage sudo mount image.img ./mntimage sudo chmod 0777 ./mntimage echo foo > ./mntimage/foo.txt cp --sparse=always image.img sparse.image.img du -sh sparse.image.img du -sh image.img
losetup
mkdir mymount1 mymount2 dd if=/dev/zero of=image.img iflag=fullblock bs=1M count=10 && sync sudo losetup --partscan --find --show image.img sudo mkfs.ext2 /dev/yourloop24 sudo mount /dev/loop24 ./mymount1/ du -sh image.img sudo chmod 0777 mymount1 echo foo > mount/foo.txt cp --sparse=always image.img image.img.sparse du -sh image.img.sparse sudo mount image.img.sparse ./mymount2
https://askubuntu.com/questions/667291/create-blank-disk-image-for-file-storage
https://www.fabianbees.de/posts/WSL-attatching-drives/
copy CD/DVD to iso image and mount
Copy
dd if=/dev/sr0 of=my-output.iso bs=10M
Mount
sudo mount -t iso9660 -o loop lotrbfme2-2.iso /tmp/a
Using noerror for attempt at protected disk
You may get something like this
dd: error reading '/dev/sr0': Input/output error 51+1 records in 51+1 records out
This may work but
dd if=/dev/sr0 of=my-output.iso bs=10M conv=noerror,sync status=progress
Try these two commands
Get volume size
isoinfo -d -i /dev/sr0 | grep -i -E 'block size|volume size' Logical block size is: 2048 Volume size is: 2264834
Set count to volume size value
dd if=/dev/sr0 of=my-output.iso bs=2048 count=2264834