How can I shrink an image of an SD card to fit a smaller card? - raspberry-pi

I've been slowly building a home automation framework (Python and SQL) on a Raspberry Pi. I'm really happy with it and am trying to deploy it on a few other Pi's around the house.
I've used win32diskimager to create a .img archive of the SD card and have (on a few occasions when I stuffed things up) been able to restore to the same card.
The problem is that (illustrative numbers only) my current "8GB" SD card is 7.88GB, but the new SD cards I've purchased are 7.86GB. The image is 7.88, so it refuses to write to the 7.86GB card (even though about half of that image is just blank space).
Can I resize my image? Tried using "truncate" in nix but (for some reason) vital data is stored at the end, or there's a checksum, because lopping off a few hundred mb was enough to corrupt the file and prevent mounting / writing.
Happy to take alternate solutions for SD card cloning too. I have access to OSX / Ubuntu / W8.1, but Windows is preferred because that's where I've got the img at the moment.
Appreciate any tips!
Sam

A bit late but I found a setup that works:
Run the SD card inside a raspberry and use
sudo apt-get install -y gparted
sudo gparted
To edit its partitions. Look for the main partition, unmount it and resize it to the desired size. I haven't confirmed whether it matters but I made sure the relevant data is "on the left" and the unallocated data on the right.
There's a more detailed guide on how to do this here:
https://learn.adafruit.com/resizing-raspberry-pi-boot-partition/edit-partitions
If you can't do this for whatever reason, an alternative is setting up a fresh SD card with a new installation of say Raspbian lite and removing the option to expand into remaining space of the SD card from cmdline.txt (in my case this was the last option in the list) BEFORE running the new installation in a Raspberry pi. Then you can set up the Pi the way you like inside a smaller partition.
Once you have shrunk the needed partitions you can easily make a small image:
In Windows, you can use Win32DiskImager to make the image, while making sure "Read Only Allocated Partitions" is checked, giving you an image that - surprise surprise - omitted the unallocated data.

Related

Write and read files from SD card flutter

Is there any way to Read and write files from external SD Card with flutter ,like using
getExternalStorageDirectory()
from path_provider package to access local storage(read,write,modify,create..)?
You can use external_path package in pub.dev.
There is another way, which is directly listing all folders before folder named 0. There are mostly three folders in the very root: emulated, (the second and third one I don't remember now).If SD card is also inserted, there is a change in the first index with some id of SD card. But, trying to directly list them throws permission error, so you should use the package provided above.
About, writing (editing, deleting), it's really hard using flutter. By default, the contents are loaded in read-only mode.

How do I use a dd-created image, that's bigger than the original disk?

I created a backup of flash card, using: dd bs=4M if=/dev/mmcblk0 of=backup.img
Now, trying to restore that back to the same card with Etcher, I'm told the image is bigger than the card, and I need 300+Mb of more space.
Should I be creating the image a different way? Is there a work-around to restoring the image? If it matters, I'm trying to maintain all of the needed partitions for a RaspberryPi. I'm new at this, so any guidance would be great (including if there's a more appropriate Exchange to ask).
Since my question was focused in particular on a RPi .img file, there is a utility, PiShrink https://raw.githubusercontent.com/Drewsif/PiShrink/master/pishrink.sh
for this very task.

Multi-store: Product image (default) import, base, small, thumbnail images are not setting in (non-default) store

I have multi-website instance. I imported product images via Magento2 (default) tool under admin->system->import....
The images imported successfully, and I can see, each imported image set as base, small and thumbnail, under product (default) store.
However, if I switch to another store via (Store View), the image exists, but did not set as base, small and thumbnail.
Please help.
Please confirm your OS, like Windows or Ubuntu?
If uploading CSV from Ubuntu, then please re-import via Windows.
Sometimes, import makes issue due to the OS.
Thanks,

Adobe Reader PDF Form flickers

I have a slight annoyance on my hands. I have an interactive online PDF form that multiple users very actively and routinely use. The problem is, anytime a user clicks on any part of the form, the form goes blank and reloads again. It's still usable, in the sense that the options chosen are being displayed on the reload, but it's still very aggravating and time wasting.
I recently saved a copy of the form so I could test out the form locally, and the issue is still persistant, which crosses out the company issued Internet Explorer 8 as being the culprit, which I thought might be the case.
So, anyone else experience this and know how to fix this?
UPDATE 4/8/2015
On further tickering, it seems that the dropdown boxes do contain quite a bit of options. This seems to be slowing down the form considerably. What's odd is when testing on an older PC, the issue is non-existant. Further investigations needed.
This seems to be the known bug in Adobe Reader if you are using Adobe Reader or Adobe Reader X to view PDF in the browser.
One of suggestions to try the following:
Go to (in Adobe Reader) Preferences : Forms,
Then untick the "Show focus rectangle" checkbox.
You may also want to try Foxit Reader that is also capable of working as plugin in IE and other browsers.
Does this form have many fields with calculations, and some of them leading to change display properties (border, background, text, text size etc.)?
Acrobat often does refresh the appearances, which, when it takes longer than just a few milliseconds, leads to a flickering effect.
In order to provide more help, I would have to have a look at the form.
This is mostly seen in systems without any GPUs or with iGPU. Monitor color profile and iGPU are bottlenecking in this case.
Solution:
Set threshold transition framerate to 30fps (con: RAM consumption may increase by 2-3 MB per 100 MB PDF file)
For no GPU/ iGPU systems use Software based rendering instead of DirectX (under Multimedia and 3-D section, Adobe Acrobat).
Set Monitor colour profile to sRGB.icm or sRGB.cdmp or scRGB.cdmp or use my colour profile. Restart your PC. You should see noticeable difference now.
PRIMARY/ONLY SOLUTION is to install a dedicated GPU for your PC. This removes the problem completely.
NOTE: 1, 2 & 3 are temporary solution.
I have attached my sRGB.icm (.icm are ICC profile and they are best) colour profiles here: "https://ln4.sync.com/dl/ca43fd730/actxknji-3t3c5krs-ifagdfin-bppsxinh". Open colorcpl.exe (Microsoft Colour management profile control) and load the files. You are all set.
Cause:
Adobe uses dynamic allocation. Microsoft edge/ chrome transfers the whole PDF to RAM but Adobe doesn't. When you jump to a particular section of the PDF what's happening is Adobe is collecting the data from the PDF and transfering it to RAM, now when CPU processes your data the GPU is lagging behind which is causing the flickering. In most cases this is the problem. The problem is not seen in other applications because they transfer the PDF completely to RAM occupying the size of the PDF file. But Adobe has lower RAM consumption for this reason. Don't open 500MB PDF files in Edge or Chrome because your PC will hang and they will crash, instead open with Adobe, Adobe is well optimized for all purposes, lower RAM consumption. So for this you need a decent GPU.
Monitor Color profile mismatch with iGPU.
Calibration error.
GPU rendering problem(old GPU).
Threshold fps and other settings to change in Adobe Acrobat Reader/Pro
Color Profile Management for monitor
One Recommendation from me: Don't ditch ADOBE ACROBAT. It is so well optimized. Microsoft Edge looks good in GUI but when you open a 500MB PDF file it will consume 1GB of RAM, I've seen it, I solve past year questions from a PDF which is of 629MB and edge transfers the whole PDF to RAM and takes 1GB or more RAM. But in Adobe, RAM consumption is about 130MB even when I am editing the PDF. Adobe softwares are designed for professional use. So, don't ditch Adobe because of this silly flickering problem. Thanks.

how to copy the contents of sd card to another

I have sd card, I installed ubuntu on it in order to use it in beagleboard.
Is there a program to copy the entire contents of the sd card to another one??!!
I basically want to copy the operating system to the other sd card.
As far as I am concerned, you need to "install" it again on another SD card. You can copy certain files but the Os just cannot be "copied" like that. The solution is to take the -iso image of the OS and reinstall it to another SD.
EDITED:
I've been looking deeper and maybe the Win32DiskImager program that is normally used to install image files to SD cards, could also "clone" your SD card. Try to download it, and as soon as you open it you have a "read" option, that would provide you a solution.Cloning the SD card is simple. Just follow these steps:P
Extracted from: http://lifehacker.com/how-to-clone-your-raspberry-pi-sd-card-for-super-easy-r-1261113524
Follow these steps to clone the SD card:
Get everything set up just the way you want it on your Raspberry Pi, whatever you're using it for. Then shut down the Pi and remove the
SD card. Insert the SD card into your computer.
Start up Win32DiskImager, a program that you probably have from when you first set up your Pi. (If you're on OS X or Linux, you'll
have to use the dd command as described here instead of these steps).
In the "Image File" box, enter the path of your soon-to-be image file. For example, I put mine in C:\Users\Whitson\images\myraspbmc.img
Under the "Device" box, select your SD card.
Click the "Read" button to create the image file from your card.
When it's done creating the image file, you can eject your SD card and put it back in your Raspberry Pi. Keep that IMG file in a safe
place.