Languages/shell/mount-o
(Difference between revisions)
Marc.pignat (Talk | contribs) (Created page with "{{public}} {{TOC right}}") |
Marc.pignat (Talk | contribs) |
||
Line 1: | Line 1: | ||
{{public}} | {{public}} | ||
{{TOC right}} | {{TOC right}} | ||
+ | = Mounting a filesystem image for editing = | ||
+ | <source lang='bash'> | ||
+ | # Create a destination directory | ||
+ | mkdir /tmp/toto | ||
+ | # Mount your existing filesystem image into it | ||
+ | sudo mount -o loop image.bin /tmp/toto | ||
+ | # Now you can see what is in this filesystem image and change the files ;) | ||
+ | # Don't forget to umount when you're done | ||
+ | </source> | ||
+ | |||
+ | = Unmounting = | ||
+ | <source lang='bash'> | ||
+ | sudo umount /tmp/toto | ||
+ | </source> | ||
+ | |||
+ | = Create an ext4 image from a sdcard = | ||
+ | <source lang='bash'> | ||
+ | sudo dd if=/dev/sdcard of=/tmp/image.bin | ||
+ | </source> | ||
+ | |||
+ | = Restore the sdcard = | ||
+ | <source lang='bash'> | ||
+ | sudo dd if=/tmp/image.bin of=/dev/sdcard | ||
+ | </source> | ||
+ | |||
+ | = Creating an empty disk image = | ||
+ | <source lang='bash'> | ||
+ | dd if=/dev/zero of=/tmp/image.bin bs=1M count=512 # a new 512M image | ||
+ | mkfs.ext4 -F /tmp/image.bin # "format" the disk image, works as a normal user ! | ||
+ | </source> |
Revision as of 16:49, 24 February 2015
|
Mounting a filesystem image for editing
# Create a destination directory mkdir /tmp/toto # Mount your existing filesystem image into it sudo mount -o loop image.bin /tmp/toto # Now you can see what is in this filesystem image and change the files ;) # Don't forget to umount when you're done
Unmounting
sudo umount /tmp/toto
Create an ext4 image from a sdcard
sudo dd if=/dev/sdcard of=/tmp/image.bin
Restore the sdcard
sudo dd if=/tmp/image.bin of=/dev/sdcard
Creating an empty disk image
dd if=/dev/zero of=/tmp/image.bin bs=1M count=512 # a new 512M image mkfs.ext4 -F /tmp/image.bin # "format" the disk image, works as a normal user !