Magic Knight
Posts: 33
Joined: Sat Jan 12, 2013 5:14 pm

dd command help

Mon Feb 11, 2013 6:19 pm

Is it possible to run the dd command via ssh to backup/image the whole sd card to an attached external usb drive ?
Something like dd if=/dev/sdcard of=/media/lacie rpi.img

User avatar
Posts: 3635
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
Contact: Website

Re: dd command help

Mon Feb 11, 2013 8:15 pm

No. In another machine, no problem, but the Pi itself would have OS files open and locked and deny access to parts of the SD card.
Don't judge Linux by the Pi.......
I must not tread on too many sacred cows......

User avatar
Posts: 18010
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: dd command help

Tue Feb 12, 2013 7:36 am

Yes, but it's really not recommended.

If you do, then you should make sure as few OS files are in use as possible. Stop all the services you can - like GUI/Webserver etc.

You will end up with a damaged image of the filesystem. How bad that is will depend on how long it took and what was updated during that time. The filesystem checks on startup will normally cope with that, but not always.

A better idea would be to load up a second SD card, boot your Pi from that, put your main card in a USB reader then use your Pi to copy its contents to your USB disk.

Also, file locks at the filesystem level won't deny access as dd uses low level reads of the card's contents and doesn't bother about such things.

Return to “General discussion”