Backup and Shrink your Raspberry Pi Image

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 ม.ค. 2025

ความคิดเห็น • 68

  • @b9038056
    @b9038056 8 ปีที่แล้ว +1

    Been looking for this for the last 2 years, thanks for the big help. Kudos to you.

    • @mihaicristian4079
      @mihaicristian4079 4 ปีที่แล้ว

      Same bro...hi....searching for almost 10 months

  • @Gosydelix
    @Gosydelix 8 ปีที่แล้ว +1

    I've been searching for something like this for a long time! Thanks and keep up the good work!

  • @DKali-gn7xj
    @DKali-gn7xj 8 ปีที่แล้ว

    Don, excellent video and tutorial. I did it slightly different, but was able to use your content perfectly.
    - I used Win32DiskImager and created an image onto an external hard drive.
    - I then replaced the SD card back into my pi and booted.
    - Connected the external hard drive to my pi and basically followed your instruction from there.
    - /media/usb0 raspberrypi.img
    - No Virtualbox, no Ubuntu VM, no folder sharing, etc.
    - The external hard drive was NTFS, but since you are mounting the image itself, you are able to modify accordingly.

  • @ccupp2
    @ccupp2 8 ปีที่แล้ว

    Wow.....thank you so much for this. Although I have no immediate need for doing this, I know it'll come in VERY handy should I ever need to change my SD cards for my Raspberry Pi. A lot of people haven't yet discovered that you cannot always restore an img file to an SD card of the same size because the SD card is very often mere bytes smaller than the SD card from which the img got made. In otherwords, I've personally bought 8GB sd cards that were different in size despite both of them 'supposedly' being 8GB. This video could come in really handy!

  • @mifo1133
    @mifo1133 8 ปีที่แล้ว

    i will search for something less complicated but if i dont find anything i will go this patch thank you a lot!

  • @07XOY070
    @07XOY070 8 ปีที่แล้ว +1

    Thank's sir ! Your channel is very cool, greetings from France !

  • @user-eu5ol7mx8y
    @user-eu5ol7mx8y 4 ปีที่แล้ว

    5:04 What does this command do exactly? What is a loop device?

  • @mackbolan8104
    @mackbolan8104 7 ปีที่แล้ว +1

    Thankyou Novaspirit Tech

  • @richardreed6868
    @richardreed6868 3 ปีที่แล้ว

    You can use PiSafe to easily create a compressed image of your SD card or USB stick. Then restore it to a different device any time you like.

  • @mythias
    @mythias 8 ปีที่แล้ว +2

    Is there a script some place for doing this to avoid having to type all that out?

  • @Oper8or
    @Oper8or 8 ปีที่แล้ว

    New Sub. Nice work. Been browsing for Kali install and saw yours. I like your videos and I'll spread the word.

  • @glennbuckberry2463
    @glennbuckberry2463 3 ปีที่แล้ว

    Is it possible to expand the partion it so you could write the image to a larger SD? I am assuming you would need to make a new swap?

    • @jim0_o
      @jim0_o 3 ปีที่แล้ว

      Just write the smaller image to you SD card, and run "sudo raspi-config" on the pi, there is an option to expand the partition, it will just use the remaining space on the card (AFAIK

  • @richardreed6868
    @richardreed6868 3 ปีที่แล้ว

    I can't seem to post where to find PiSafe. It is on that opensource developers website that starts with git. Then RichardMidnight then pi-safe. - peace

  • @arokan327
    @arokan327 3 ปีที่แล้ว

    Hey NT! Is there a way to automate this process with a bash script?

  • @tonypolcino1757
    @tonypolcino1757 7 ปีที่แล้ว

    How do you mount the image to copy files from it and send them to a USB... for example. I have an IMG file with a lot of videos and files in it the staff member that made it has is no longer with company and now I need to extract those files and copy the files to a USB for editing etc.

  • @RogerPayne
    @RogerPayne 4 ปีที่แล้ว +1

    for those following this and cant get the share to mount, install the following
    $ sudo apt-get update
    $ sudo apt-get install virtualbox-guest-additions-iso
    ) Now install guest additional package (Crucial step! People generally miss this which creates an error “Unknown file type “vboxsf”)
    $ apt-get install virtualbox-guest-utils

  • @MrSoftwizard
    @MrSoftwizard 8 ปีที่แล้ว

    Great tutorial, as always... I'd like to know if you might use a Raspberry Pi for scanning and fixing bad sectors of a HHD? Also to recover accidentally lost data after formatting. It would be very useful thing.

  • @maheshthecrazy
    @maheshthecrazy 7 ปีที่แล้ว

    Kali Linux has 2 partiions on the SD card..one with file system and one withh boot files... they show up with different drive letters ..how to back up both drives together in to a single IMG file ???

  • @davidhn
    @davidhn 8 ปีที่แล้ว +1

    nice tutorial, thanks!

  • @mihaicristian4079
    @mihaicristian4079 4 ปีที่แล้ว

    TYSM I SEARCHED FOR THIS A LOTT

  • @DiyintheGhetto
    @DiyintheGhetto 7 ปีที่แล้ว

    Hello i have a Question can this process be used more then a Backup? Say like cloning to another SD card, Like saying okay i want to make a mirror copy of the Pi SD card to another SD card just in case something happens to the first Pi SD card? also if there is any changes from the first SD card it can make the same changes on the Backup SD card?

  • @redwez1982
    @redwez1982 6 ปีที่แล้ว +1

    Simply awesome!

  • @slappymcphee
    @slappymcphee 6 ปีที่แล้ว

    Didn't work for me, but thanks. I am running into an odd situation where when I use the pishrink program is shrinks for example from 15GB to 6.6GB. When viewing the partition in gparted it is showing there is 4.28GB Used and 1.98GB Unused. I try to resize/move and no matter what I chose it always fails with "resize2fs: new size smaller than minimum" so I am at my whits end.

  • @richardreed6868
    @richardreed6868 3 ปีที่แล้ว

    Trying again... I can't seem to post where to find PiSafe. It is on that opensource developers website that starts with git and ends with hub. Then RichardMidnight then pi-safe. - peace

  • @jpmendes54
    @jpmendes54 7 ปีที่แล้ว +1

    For Windows users no need to use Virtualbox. Find 'pyshare' on Github download it, put it in a windows directory together with the Pi image to compress, share that directory with rw previleges to everyone, mount that dir on the Pi and run 'sudo ./pyshare.sh foo.img foo_shrink.img' from the mounted directory. Of course you have to install 'samba' on the Pi. For a 8 Gb image the whole process took about on hour. You cannot shrink a NOOBS image with this process because of multiple types of partitions in NOOBS. Use it only with plain Linux images. Cheers!
    PS: I forgot to say that if you want the program to work over original image the process is much faster, just type '. sudo ./pishrink foo.img'

  • @gt20modding88
    @gt20modding88 6 ปีที่แล้ว

    Can you release the stripped raspbian?

  • @TheMagicboy1993
    @TheMagicboy1993 8 ปีที่แล้ว

    Hi Could someone help me. After following this video i put my sdcard to my raspberry pi. It shows a message ""waiting for sdcard (settings partition)" How can i resolve this issue

  • @Popart-xh2fd
    @Popart-xh2fd 8 ปีที่แล้ว +2

    Zip doesn't work?

  • @jerraynes240
    @jerraynes240 6 ปีที่แล้ว

    Please help me on this one i always get this error " losetup: raspbian.img: failed to set up loop device: Device or resource busy"

    • @joeynguyen3088
      @joeynguyen3088 4 ปีที่แล้ว +1

      I know this comment is old but I'm replying for people who are reading it later. If you get the error above, run `df -h` and find the highest numbered /dev/loop filesystem. Increment it by 1 and use it in the losetup command. So if the highest numbered /dev/loop in your filesystem is /dev/loop5, run `sudo losetup /dev/loop6...`

    • @kristopiir3107
      @kristopiir3107 4 ปีที่แล้ว

      Hello. Quite late response for sure. But I ended up here just today :)
      I used the command "losetup -f"
      It searches for available loop device. For me it found loop9 and I used that till the end.
      Later - Raspberry booted up and this works for me.
      Thanks for the tutorial!

    • @stdavid_
      @stdavid_ 3 ปีที่แล้ว +1

      ​@@joeynguyen3088 Thank you so much!!!

  • @yannis486
    @yannis486 7 ปีที่แล้ว

    How to backup an SD card with multiple partitions?

  • @mattmanandeddie
    @mattmanandeddie 8 ปีที่แล้ว

    If you zip the lite image, will it shrink it down any smaller?

    • @bobsobol
      @bobsobol 8 ปีที่แล้ว

      +Edward Armstrong Yup. How much depends on how much use your disk got before it was imaged. Remember, deleted files aren't gone from the disk, just unlinked from the directory structure. ... See my other comments for a way around that. ... Actually, the Disk Tool on a Mac lets you wipe unused space too, if you have a extfs installed to cope with a Linux filesystem. Sadly the Gnome equivalent doesn't have that option, and nor does gparted. :(

  • @tylertrowbridge3929
    @tylertrowbridge3929 8 ปีที่แล้ว

    Can you post that raspbian-lite image you made? I'm looking for a lite version, but I can change the network config. thx

  • @Arijit_B
    @Arijit_B 8 ปีที่แล้ว

    Very Good Tutorial- learn some new commands - thanks for that - But it is easier to buy some extra TB's HDD to back up nine thousand SD Card for the nine thousand project....I think if somebody really need the same to do for their valuable project they are going to buy multiple HDD's to back up their project/research about RPi Image.

  • @tapojyotiacharya
    @tapojyotiacharya 8 ปีที่แล้ว

    Excellent job...

  • @ahsan-li7sh
    @ahsan-li7sh 8 ปีที่แล้ว

    great tutorial

  • @prebenborg
    @prebenborg 8 ปีที่แล้ว

    Very cool and very useful but do you think I could do this on my Mac Mini (it's running UNIX too)?

    • @NovaspiritTech
      @NovaspiritTech  8 ปีที่แล้ว +1

      +Preben Borg yup I believe instead of using gparted you would need to use parted. And you would also have to dd the image from the sdcard. The fdisk part should be the same methodology

    • @bobsobol
      @bobsobol 8 ปีที่แล้ว +1

      +Preben Borg The Disk Tool on your Mac can make a compressed image of the disk, but it can't resize extfs partitions unless you install an extfs KEXT driver. (I believe some exist, but I'm not sure how _clean_ they are, as I have never tried) Just the fact that it's a compressed image means it will be a smaller file. (if that's all you care about)
      However, you need to shrink the volume if you find you want to put it on a _smaller_ SD card later on. You can always put it on a bigger one though. ;)

  • @galaxy4dayz
    @galaxy4dayz 6 ปีที่แล้ว

    can you plss do a Mac tutorial if you find away? plss...

    • @gt20modding88
      @gt20modding88 6 ปีที่แล้ว

      Galaxy4Dayz Ok mac is based on linux (Debian) just run those linux commands on your mac.

  • @JoshLineberry
    @JoshLineberry 8 ปีที่แล้ว +9

    That was a lot of extra steps for nothing man.
    All you have to do is go into GParted and shrink the partition and then do this simple command.
    Copy/Resize SD Card:
    sudo dd if=/dev/mmcblk0 of=/home/josh/Desktop/backup.img bs=1M count=4800
    And this is what the parameters are.
    (if=SD Card/Directory) (of=Where and what you want to save it as) (count=size in mib)
    You need to make the size in mib a little bit bigger than the size you shrunk it to. You can go to google and search what is (?gb) in mib and it will tell you.
    Then, to add the image back to an sd card you simply use:
    sudo dd if=/home/josh/Desktop/backup.img of=/dev/mmcblk0 bs=1M
    Where (if=the image file and directory) and (of=Sd Card with its directory)
    Or, you can simple double click on the new img file and restore it to the sd card thru the GUI.

    • @jainravish
      @jainravish 8 ปีที่แล้ว

      👍

    • @JeffZiegler76
      @JeffZiegler76 4 ปีที่แล้ว

      I don't see how this works with 2 partitions on the SD card and getting win32diskimage or etcher to restore it to a sd card like what Novaspirit solution does? Thanks.

  • @stdavid_
    @stdavid_ 3 ปีที่แล้ว

    Thanks!

  • @westermin8654
    @westermin8654 8 ปีที่แล้ว

    Very useful :D

  • @michelleasjes7805
    @michelleasjes7805 7 ปีที่แล้ว

    Thank you master ;-) After a night spending to set up Oracle VM VirtualBox and tweaking it, i did what you showed with succes. Pff hard days work but glad. Your the best. Now i heave a testing Ubuntu 64 17.04 testsystem. So 2 in one. (lol)

  • @Deleted_Goodbye
    @Deleted_Goodbye 8 ปีที่แล้ว

    PiShrink.sh on github supposedly automates this process. It's a bash script that strips out unused space.

    • @cesarsoto4551
      @cesarsoto4551 6 ปีที่แล้ว

      I had no success with pishrink... A couple of other people had the same errors. I tried this and it worked the first time.

  • @billcarson1966
    @billcarson1966 7 ปีที่แล้ว

    Way complicated. Just use compression software. My Example - 7-zip ultra setting gets my 32gb image down to 6gb. I also have and use WinRar.

  • @007systems7
    @007systems7 3 ปีที่แล้ว +1

    I will just buy a bigger hard rive. Thanks anyway...

  • @precisiondesignok
    @precisiondesignok 8 ปีที่แล้ว +2

    wow skipped over like 5 steps in the beginning???

  • @imnutrak130
    @imnutrak130 4 ปีที่แล้ว

    this video recording date - i see what you did there

  • @kaizartariq9531
    @kaizartariq9531 8 ปีที่แล้ว

    thanks.. :)

  • @Un_Pour_Tous
    @Un_Pour_Tous 6 ปีที่แล้ว +1

    Jesus christ. Need a app that can do all this.

  • @Raylightsen
    @Raylightsen 5 ปีที่แล้ว +1

    This thing looks insanely unnecessary and confusing.

  • @laszlotakacs668
    @laszlotakacs668 8 ปีที่แล้ว

    Easier with Clonezilla.

  • @juanfranciscomolinaromero7162
    @juanfranciscomolinaromero7162 8 ปีที่แล้ว

    Excellent video. I subscribed as soon as I saw the first video from Novaspirit. I am getting stuck in Gparted. After I click on Apply, to resize the partition, I get an error message saying "check file system on /dev/loop0 for errors and (if possible) fix them. I have prepared a screenshot here, if that helps. screencast.com/t/1i43zYX6Mr Has anybody had the same issue before? It seems Ubuntu 16 is mounting the image as ext4 and gparted likes a different file system. I am not a Linux expert. If anybody can give me a hint, it would appreciate so much. Regards, Juan

  • @FunnyAsian00
    @FunnyAsian00 4 ปีที่แล้ว

    When it comes to tech I trust Asians... Jusy don't trust me I'm Asian