Hot answers tagged

88

This question is answered as part of the answer to other questions, but it deserves canonical treatment here so it does not have to keep being repeated. You can't mount the image as a whole because it actually contains two partitions and a boot sector. However, you can mount the individual partitions in the image if you know their offset inside the file. ...


40

Just use the unxz program: unxz kali-1.1.0-rpi2.img.xz Note: the original file will be removed. Only the .img file will remain. If you want to keep the original archive, use unxz --keep kali-1.1.0-rpi2.img.xz .


30

You can use xzcat and dd together. xzcat kali-1.1.0-rpi.img.xz | dd of=/dev/SDCARDNAMEGOESHERE It retains original file.


25

losetup provides partition probing through -P. Using this makes mounting partitions of a full disk image such as the Raspbian SD card image very easy: losetup -P /dev/loop0 raspbian.img mount /dev/loop0p2 /mnt mount /dev/loop0p1 /mnt/boot


23

On Linux or OSX I use dd to make a backup from SD card. Reverse if and of (i.e. to where they point - source and destination) afterwards to restore, but be careful not to restore to a wrong disk. It will be destroyed without a warning!!! First use fdisk to get the device id of you SD card (check the size) fdisk -l then I use dd to make a diskimage (...


21

To take pictures in 0.025s with picamera you'll need a frame-rate greater than or equal to 80fps. The reason for requiring 80 rather 40fps (given that 1/0.025=40) is that currently there's some issue which causes every other frame to get skipped in the multi-image encoder so the effective capture rate winds up as half the camera's framerate. The Pi's camera ...


19

you need to recompile a kernel in order to do that. create your image with no more than 224 colors, and 80x80px in size. Save the image as png, and run the following (provided you have netpbm installed and kernel source in /usr/src/linux): $ pngtopnm logo.png | ppmquant -fs 223 | pnmtoplainpnm > logo_linux_clut224.ppm $ cp logo_linux_clut224.ppm /...


17

You mention in a comment to RooTer that A) you have reduced the initial partition size with gparted, but dd still copies the whole card, and B) that you want to include both partitions in the image. Issue "A" is easy to explain: you are still copying the whole card because that's what /dev/mmcblk0 refers to. The individual partitions are of course /dev/...


16

In this answer, I demonstrate what to do step-by-step for people to understand the logic behind the solution and to be able to apply steps in their other problems. But firstly, it should be stated that it is a generic (not raspi specific) problem to migrate filesystems from an SD card to a smaller (but big enough for data) SD card. Requirements A laptop ...


14

I have adapted @goldilocks answer on rsync for back-up on the pi. I backup to an ext4 partition on a HDD mounted on the Pi. If the HDD is not mounted, rsync would copy to the mount directory (until the SD Card is full). If the HDD is not mounted in rw mode copious error messages are produced. Neither of these is desirable, so I check that my partition is is ...


14

So the best way I have found is to use GParted (you can either use a Linux-based OS, or boot from a GParted Live USB). It is simple enough to find detailed instructions on how to do each of these steps in detail, but here is the general method I have found to work: Run GParted, find your SD card in the device list and shrink the main partition to as small ...


13

I recently had to make a backup image for my Raspberry Pi 3 Model B and found an incredibly helpful guide from Beebom. The guide outlines the process for cloning and restoring a Pi SD image for all three operating systems. (Windows - Linux - MacOS). For this detailed and helpful guide visit: How to Clone Raspberry Pi SD Card on Windows, Linux and macOS.


12

All images available at https://www.raspberrypi.org/downloads/raspbian/ are compatible with all Pi models. Of course, this may change in the future


10

Ok so I finally found an answer and I wish to share it with you guys. My guess is that the creators created the compressed file from an expanded image by mistake. The fact that the compressed file is nearly 1.1 GB, compared to 8.1 GB of the extracted files, proves this. Empty space will compress to a couple of bytes. If there were additional packages, there ...


9

The exists a nice tool called pishrink which reduces the size of a dd image as much as possible by shrinking the root partition. If you start up the restored image the first time the partition is expanded to it's maximum size again. If you run Windows just use your Linux on your Raspberry to shrink the image.


8

Just use the Print Screen key on your keyboard that will save a PNG image in your home directory (/home/pi) of the whole desktop.


8

Linux / OSX Download the image from here Extract the .xz file using any of the following methods Tar tar xf CentOS-Userland-7-armv7hl-Minimal-1511-RaspberryPi2.img.xz Unxz unxz CentOS-Userland-7-armv7hl-Minimal-1511-RaspberryPi2.img.xz The Unarchiver (OSX) Install from Mac App Store here Use the disk cloning command dd to copy the img contents to your ...


8

Not quite. You would overwrite the partition tables when you re-image it and replace said tables with the ones from the image. After your imaging program is done, it would release the file handle to the image file, but since the partition where the file is stored technically doesn't exist anymore, your program can't read it again. In theory, it would work ...


7

I have three Pis running in my local net and need to backup them on a regular base with cron when they are up and running. That's why I created a script which is able to create dd, tar and rsync backups and to restore them. I prefer to use rsync for my backups but other folks prefer dd or tar. It's used by a lot of people already. Hope it's useful for others ...


7

I had the same requirements as 1 and 2 to distribute a customized OS. After looking around I found many commands, but not a single tool to create a compact .zip file from an SD card, so I wrote mkimg.sh, which works like this: sudo bash mkimg.sh /dev/sda sdcard.img.zip This takes the unmounted device at /dev/sda, shrinks down the filesystem and partition, ...


7

From the picamera docs (Section 4.3. Capturing to a PIL Image): import io import time import picamera from PIL import Image # Create the in-memory stream stream = io.BytesIO() with picamera.PiCamera() as camera: camera.start_preview() time.sleep(2) camera.capture(stream, format='jpeg') # "Rewind" the stream to the beginning so we can read its ...


6

This is a synthesis of the answers above and elsewhere that worked for me - back up your image in case you make a mistake: Firstly make the image file bigger (here we're adding 1GB to the end): truncate -s +1G ./image.img Next map the whole image as a loop device so we can poke at the partition table sudo losetup /dev/loop0 ./image.img For future ...


6

TL;DR: uninstall PIL, install and link libjpeg-dev, and reinstall PIL. The general solution is to install libjpeg-dev before installing PIL: sudo apt-get install libjpeg8-dev However, PIL still doesn't know where to find the shared library. Following the general solution (above) doesn't work since the Pi is ARM-based, not intel32/64. Still, it isn't hard ...


6

The 8GB is only the guideline size of a card. Because of the nature of flash memory and management of dead cells there are slight variations in actual usable space. This usable space will also decrease as the card gets older and older. With SSD's and SD cards like this it is a good idea to leave a small amount of space that is unused. I would say about 1% ...


6

Indeed not all SD cards are the same exact size. You'd have to shrink the partition to make it fit on the smaller SD. I had a similar problem myself. What I did was have a separate SD with (in my case) Raspbian. And I plugged in my SD I wanted to resize, using a USB card reader. Before you can safely shrink you partition, you need to make sure there is no ...


6

OK after a long search I 've found a reliable version of yolo called YAD2K. I have use tiny-yolo which takes about 1.5s per frame on a raspberry pi 3.


6

I had this problem and it turned out to be a faulty sd card. I tried to delete partitions and reformat the sd card but it plain refused. Use another sd card and it was fine.


6

Late to the party, but I had the same issue today: $ sudo dd if=output/images/sdcard.img of=/dev/mmcblk0 bs=2M status=progress 66+1 records in 66+1 records out 138412544 bytes (138 MB, 132 MiB) copied, 0.0644025 s, 2.1 GB/s As it turns out, sometimes the device file /dev/mmcblk0 does not get deleted when the SD card is removed, and when the device is ...


6

It is possible to create an empty image for a Raspberry Pi. Then you can copy an operating system with a boot and root partition to it and boot. To fill the empty image you can use any usable file copy method, e.g. from a tar archive, or rsync, or just cp. This way you are completely free to shrink or expand storage, or use other partition sizes than given ...


5

I know this is an old question, but I would like to show how to do this process on Mac, because it is not as easy: fdisk doesn't have the -l option, and truncate is not installed by default: 1. Step 1: Install truncate on Mac OS X: You need MacPorts or Homebrew for this. I use MacPorts. If you don't have one of these, go ahead and install them first. Link ...


Only top voted, non community-wiki answers of a minimum length are eligible