Hello,
I recently had a few crashes with my SD card so I would like to start saving the image on my computer. I have done a lot of uninstalls / installs on the image, and I don't want to redo the process every time.
When I execute:
sudo dd bs=1m if=/dev/rdisk1 of=RPi.img
I get an image RPi.img which looks pretty good, but it has a size of 8Gig, which is the size of my SD card. I only want to copy the used data, what can I do?
Thanks!
-
- Posts: 40
- Joined: Tue Jun 12, 2012 7:20 pm
Saving SD-image to mac?
http://www.pieter-jan.com/
Re: Saving SD-image to mac?
Any good compression program will see the free space , making
the resulting file ~ 700 megs big.
ghans
the resulting file ~ 700 megs big.
ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org
-
- Posts: 4277
- Joined: Sun Jan 15, 2012 1:11 pm
Re: Saving SD-image to mac?
As the previous poster noted, one way to do it is to just compress the resulting file. But this only solves one side of the problem (file size), but not the one that is really more likely to matter (the fact that it takes too long - because you're copying mostly unused space).
Another way to do it is to do a file copy, rather than an image copy. That is, do something like:
mkdir $HOME/PiBackup
cd $HOME/PiBackup
cp -a /mnt/SDcard .
Another way to do it is to do a file copy, rather than an image copy. That is, do something like:
mkdir $HOME/PiBackup
cd $HOME/PiBackup
cp -a /mnt/SDcard .
And some folks need to stop being fanboys and see the forest behind the trees.
(One of the best lines I've seen on this board lately)
(One of the best lines I've seen on this board lately)
Re: Saving SD-image to mac?
if you use rsync you don't have to switch the Pi off....
rsync -a / remotemachineip:/backupdirectory
rsync -a / remotemachineip:/backupdirectory
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe
WARNING - some parts of this post may be erroneous YMMV
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe
-
- Posts: 4277
- Joined: Sun Jan 15, 2012 1:11 pm
Re: Saving SD-image to mac?
Yes. rsync is a nice tool. Certainly the right approach once you've made a backup and want to keep it up-to-date.RaTTuS wrote:if you use rsync you don't have to switch the Pi off....
rsync -a / remotemachineip:/backupdirectory
And some folks need to stop being fanboys and see the forest behind the trees.
(One of the best lines I've seen on this board lately)
(One of the best lines I've seen on this board lately)
Re: Saving SD-image to mac?
That's quite interesting. Can RSync be used to create a sort of incremental backup to a network fileshare? Or is it a single snapshot only?
--------------
The purpose of a little toe is to ensure you keep your furniture in the right place.
The purpose of a little toe is to ensure you keep your furniture in the right place.
-
- Posts: 40
- Joined: Tue Jun 12, 2012 7:20 pm
Re: Saving SD-image to mac?
Will the previous solutions result in an image? I really want an image that I can put on any SD card without having to install anything else first ...
http://www.pieter-jan.com/
- PIstolero
- Posts: 101
- Joined: Mon Jul 23, 2012 6:28 am
- Location: paradise city, where the grass is green and the girls are pretty
Re: Saving SD-image to mac?
No, with rsync you don´t get an bootable image from your SD card, only the files.
I don´t know OSX but with Linux you can use a pipe to zip the image on the fly, for example:
sudo dd bs=1m if=/dev/rdisk1 | gzip -c > /tmp/rpi.img
Does this work with OSX? (maybe something else then gzip)
I don´t know OSX but with Linux you can use a pipe to zip the image on the fly, for example:
sudo dd bs=1m if=/dev/rdisk1 | gzip -c > /tmp/rpi.img
Does this work with OSX? (maybe something else then gzip)
Last edited by PIstolero on Fri Aug 31, 2012 4:05 pm, edited 1 time in total.
Re: Saving SD-image to mac?
Mac OS X has gzip.
--------------
The purpose of a little toe is to ensure you keep your furniture in the right place.
The purpose of a little toe is to ensure you keep your furniture in the right place.
Re: Saving SD-image to mac?
My Mac Mini (10.7) won't mount the file system, so I've been using:
sudo diskutil unmount /dev/disk5s1
sudo dd bs=100m if=/dev/rdisk5 of=WPNSbackup.img
sudo diskutil eject /dev/rdisk5
And yeah, it's ugly, but makes an image that will be restorable using dd on the mac. 8G of 'wasted' space on my Mac isn't noticable. 8*)
sudo diskutil unmount /dev/disk5s1
sudo dd bs=100m if=/dev/rdisk5 of=WPNSbackup.img
sudo diskutil eject /dev/rdisk5
And yeah, it's ugly, but makes an image that will be restorable using dd on the mac. 8G of 'wasted' space on my Mac isn't noticable. 8*)
-
- Posts: 4277
- Joined: Sun Jan 15, 2012 1:11 pm
Re: Saving SD-image to mac?
As I said, it's not the space that's the issue (in these modern, enlightened times), but the *time*.wpns wrote:My Mac Mini (10.7) won't mount the file system, so I've been using:
sudo diskutil unmount /dev/disk5s1
sudo dd bs=100m if=/dev/rdisk5 of=WPNSbackup.img
sudo diskutil eject /dev/rdisk5
And yeah, it's ugly, but makes an image that will be restorable using dd on the mac. 8G of 'wasted' space on my Mac isn't noticable. 8*)
To my mind, the problem is that it is going to take a long time [*] to make an 8G image, and most of that time is wasted (i.e., copying empty space).
[*] Or, as Harrison Ford says in "6 Days, 7 Nights", "A long, long, long, long, *long* time" (one of my favorite movie lines)
P.S. Yes, you don't get a "ready to go" image, but you're a smart guy. You'll figure out how to restore it - it is quite easy.
P.P.S. If I were going this, I'd make a ZIP file of the FAT partition - just do it once and be done with that end of it. Then I'd use rsync to make and maintain an incremental, file-by-file, image of the Linux partition.
And some folks need to stop being fanboys and see the forest behind the trees.
(One of the best lines I've seen on this board lately)
(One of the best lines I've seen on this board lately)
Re: Saving SD-image to mac?
Hi. I've just tried this dd command: sudo dd bs=1m if=/dev/disk1 of=RPi.img.
With this result:
3781+1 records in
3781+1 records out
3965190144 bytes transferred in 686.081772 secs (5779472 bytes/sec)
My question is where is the output file located?
Thanks.
With this result:
3781+1 records in
3781+1 records out
3965190144 bytes transferred in 686.081772 secs (5779472 bytes/sec)
My question is where is the output file located?
Thanks.
Re: Saving SD-image to mac?
in the directory that your ran the commandfromJames80A wrote:Hi. I've just tried this dd command: sudo dd bs=1m if=/dev/disk1 of=RPi.img.
With this result:
3781+1 records in
3781+1 records out
3965190144 bytes transferred in 686.081772 secs (5779472 bytes/sec)
My question is where is the output file located?
Thanks.
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe
WARNING - some parts of this post may be erroneous YMMV
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe
-
- Posts: 6
- Joined: Mon Mar 04, 2013 1:26 am
Re: Saving SD-image to mac?
I'm trying to figure out what to grab for the image... When I run "mount," I have two choices to choose from:
Silly question, but I'm only going to grab if=/dev/mmbcblk0p1 , right (since it's the one with /boot)?
Thanks!
Edit: Also, I tried to run "bs=1m," but got 'invalid number '1m.' I tried 1M, and it seemed to work, but I probably just massively changed the intent of the instruction, right?
Code: Select all
/dev/mmcblk0p2 on / type ext4 (rw,noatime)
proc on /proc type proc (rw)
devpts on /dev/pts type devpts (rw,noexec,nosuid,relatime,gid=5,mode=620)
/dev/mmcblk0p1 on /boot type vfat (rw,noatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw)
Thanks!
Edit: Also, I tried to run "bs=1m," but got 'invalid number '1m.' I tried 1M, and it seemed to work, but I probably just massively changed the intent of the instruction, right?
Re: Saving SD-image to mac?
I don't think it makes much sense to use dd on a running system.
Plug the SD Card into a Linux or Mac box , then you can use
the instructions.
ghans
Plug the SD Card into a Linux or Mac box , then you can use
the instructions.
ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org
Re: Saving SD-image to mac?
/*
Then I'd use rsync to make and maintain an incremental, file-by-file, image of the Linux partition.
*/
Does that work on a running system?
Then I'd use rsync to make and maintain an incremental, file-by-file, image of the Linux partition.
*/
Does that work on a running system?
Re: Saving SD-image to mac?
yes .....wpns wrote:/*
Then I'd use rsync to make and maintain an incremental, file-by-file, image of the Linux partition.
*/
Does that work on a running system?
YMMV
depending that you are not changing system files at the same time you should be fine
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe
WARNING - some parts of this post may be erroneous YMMV
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe
Re: Saving SD-image to mac?
Salut,
Quand j'essaie de backuper la carte sur mon macavec:
sudo dd bs=1m if=/dev/rdisk0 of=RPi.img
ça tourne indéfiniment et si je l'arrête avec CTRL + C, je m'apperçois que la taille est déjà à plus de 15Go or c'est une carte de 4Go
Si une âme charitable pouvait m'aider
Quand j'essaie de backuper la carte sur mon macavec:
sudo dd bs=1m if=/dev/rdisk0 of=RPi.img
ça tourne indéfiniment et si je l'arrête avec CTRL + C, je m'apperçois que la taille est déjà à plus de 15Go or c'est une carte de 4Go
Si une âme charitable pouvait m'aider

Re: Saving SD-image to mac?
Bonjour bender86.
Il y a beaucoup de chance que disk0 soit le disque principal du Mac et pas la carte SD.
Thierry
Il y a beaucoup de chance que disk0 soit le disque principal du Mac et pas la carte SD.
Thierry