7fh3498f
Posts: 28
Joined: Sat Apr 14, 2018 10:09 am

dd of SD Card where Rasbpian is up and running...

Tue Apr 17, 2018 8:11 pm

HI guys,

I use Win32 Disk Imager to backup my Pi. Works well.

I was wondering if it is possible to perform dd command of SD card where Raspbian is up and running. Any clues if that will do exact copy as Win32 does? Or some file might be missing as used by system? I am new in Linux...

Would be much easier if i could just take the .img file via Samba. Also my Pi uptime would not be disturbed. Thank you.

User avatar
B.Goode
Posts: 8500
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: dd of SD Card where Rasbpian is up and running...

Tue Apr 17, 2018 8:19 pm

Why reinvent the wheel?

Doesn't the card copier utility installed as standard with Raspbian meet your needs?

User avatar
KLL
Posts: 1453
Joined: Wed Jan 09, 2013 3:05 pm
Location: thailand
Contact: Website

Re: dd of SD Card where Rasbpian is up and running...

Tue Apr 17, 2018 11:07 pm

RASPBIAN: Desktop SD card copier ( is piclone ) or CLI ( is rpi-clone )
is very good, unless you need a .img
then use @RonR
7fh3498f wrote: if i could just take the .img file via Samba. Also my Pi uptime would not be disturbed. Thank you.
read also this about the incremental backup and
SAMBA .img filetransfer ( incl. zip ) to PC for use etcher to make a new SD card.
Last edited by KLL on Wed Apr 18, 2018 6:40 am, edited 2 times in total.

7fh3498f
Posts: 28
Joined: Sat Apr 14, 2018 10:09 am

Re: dd of SD Card where Rasbpian is up and running...

Wed Apr 18, 2018 5:48 am

B.Goode wrote:
Tue Apr 17, 2018 8:19 pm
Why reinvent the wheel?

Doesn't the card copier utility installed as standard with Raspbian meet your needs?
Never heard about it. I use Raspbian Lite (with manually installed GUI) and there is no icon like that in menu start. Can i ask for package name so i could install it manually?

Does that program copy entire card like DD? And can i use Win32 Disk Imager to recover my Raspbian just in case something will go wrong?

Thank you guys.

fanoush
Posts: 477
Joined: Mon Feb 27, 2012 2:37 pm

Re: dd of SD Card where Rasbpian is up and running...

Wed Apr 18, 2018 6:01 am

7fh3498f wrote:
Wed Apr 18, 2018 5:48 am
Does that program copy entire card like DD?
Not exactly like dd but the result is very similar. I used it to copy SD card to SSD to boot over USB and it worked fine. It re-created partitions on SSD so it would fill whole space and asked me if partitions/filesystems should have same UUID as on SD card or different one. So it most probably copies data with tar, rsync or cp. The result boots fine and contains everything.

jahboater
Posts: 4675
Joined: Wed Feb 04, 2015 6:38 pm

Re: dd of SD Card where Rasbpian is up and running...

Wed Apr 18, 2018 6:29 am

fanoush wrote:
Wed Apr 18, 2018 6:01 am
7fh3498f wrote:
Wed Apr 18, 2018 5:48 am
Does that program copy entire card like DD?
Not exactly like dd but the result is very similar. I used it to copy SD card to SSD to boot over USB and it worked fine. It re-created partitions on SSD so it would fill whole space and asked me if partitions/filesystems should have same UUID as on SD card or different one. So it most probably copies data with tar, rsync or cp. The result boots fine and contains everything.
Whereas dd copies everything including unused blocks - not sure why anyone would want that.

RonR
Posts: 514
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: dd of SD Card where Rasbpian is up and running...

Wed Apr 18, 2018 6:32 am

7fh3498f wrote:
Tue Apr 17, 2018 8:11 pm
HI guys,
I was wondering if it is possible to perform dd command of SD card where Raspbian is up and running. Any clues if that will do exact copy as Win32 does? Or some file might be missing as used by system? I am new in Linux...

You cannot use dd to copy running media. Sooner or later (more sooner than later), you'll end up with a copy that has an inconsistent (corrupted) file system.

The safest way to copy a running system is to use a backup program that utilizes rsync, such as image-backup:

viewtopic.php?f=91&t=210202#p1298239

User avatar
RaTTuS
Posts: 10456
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: dd of SD Card where Rasbpian is up and running...

Wed Apr 18, 2018 7:09 am

if you dont want to use piclone [or whatever it's called cannont check right now]
then use
rsync -ax / /other/device
followed by a
cp /boot /other/device/boot

or similar
dd is not the best tool for this
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

fanoush
Posts: 477
Joined: Mon Feb 27, 2012 2:37 pm

Re: dd of SD Card where Rasbpian is up and running...

Thu Apr 19, 2018 12:00 pm

RaTTuS wrote:
Wed Apr 18, 2018 7:09 am
rsync -ax / /other/device
Instead of -x with / one can also mount root filesystem again to different place and rsync that. AFAIK multiple mounts of same device work just fine.
The advantage is that you also copy content hidden behind mount points. I've seen systems where /dev/ contained static device nodes needed for boot and later in boot sequence such non-empty /dev/ was used for devfs mount. Your rsync example would not copy such hidden files so the system would not boot.

Return to “Beginners”