[HLUG] Quick Linux Question aimed at but not exclusively for - Julian
Richard Leszczynski
rjr.leszczynski at gmail.com
Wed Apr 22 23:52:21 UTC 2015
Paul,
Here's my simple approach to the problem. It's late and I'm tired, so
I hope I've got this right... Other's may have more sophisticated or
more foolproof solutions:
you'll need to use the dd command to copy data to and from the SD
card. For basic usage it reads data from an input file (if) and writes
it to an output file (of).
e.g. the following command will backup your sd card to a file called
pi_sd_backup.img in your linux desktop computer's home directory.
dd if=/dev/sdz of=/home/paul/pi_sd_backup.img
where:
- if is the device path to the sd card you want to backup. It should
be unmounted at the time of running the command.
- of is a path and filename of your choice for creating the backup of
the sd card
Now to copy the backup from your linux desktop computer to a new sd
card, you should only have to swap the paths around:
dd if=/home/paul/pi_sd_backup.img of=/dev/sdz
where:
- if is the path to the previously created backup of the sd card
- of is the device path to the sd card you want write the backup to.
It should be unmounted at the time of running the command.
NB: dd has acquired the nickname of "data destroyer" as it will
overwrite in an immediate no-questions-asked manner whatever you
specify as the output file. There will be no insightful kind of "are
you sure you want to overwrite your boot partiiton?" warning/question
beforehand and there will be no "undo" option afterwards... Use 'fdisk
-l' to discover the device path of your sd card before running any
commands. I've deliberately used the disk sdz which is unlikely to
exist on your system to ensure a casual bit of copy and paste doesn't
end up annihilating anything important.
Also it you have a spare card now, you might want to use it to verify
the second command successfully copies the backup to the second sd
card and that the pi will boot with the new card before deleting the
contents of the first sd card, just to make sure that it's all working
as expected.
zipping the backup afterwards (or piping dd's output through gzip)
should save a lot of space too,
hope this helps,
Richard Leszczynski
On Wed, Apr 22, 2015 at 7:44 PM, Paul <paul at paulnjulia.co.uk> wrote:
> Hi Julian,
>
> I've frequented the HLUG on a few occasions, but cant get the time to get up
> there as much now. I see you are a great linux fan, and I wondered if you
> could help me with a little matter.
>
> I have a raspberry pi and want to set up a card which I can just copy onto
> new sd cards as and when. So I download the NOOBs from pi.org (onto the
> linux Desktop) and simply copy it to the sd card thru the command line or
> even drag and drop onto the card from the GUI.
>
> After putting the card in the pi and powering it up, the pi expands the
> NOOBs to a fully functioning OS.
>
> This is what I require help on, I want to put the SD card back into the
> linux driven Desktop and copy the files from the card to a new Folder, so
> that in future I can just put a new SD card in the sd card reader and copy a
> fully operating OS, plus any other tweaks I have put onto the card onto the
> new card, from either the GUI or command line.
> One of my issues is what instruction do I type at the command line to copy
> the whole card from the card to a subdirectory on the desktop and then to
> copy from the directory to a new card in the card reader?
>
> Any help, guidance greatly appreciated.
>
>
> --
> Cheers,*
> P**au**_l_*
>
> --
> Herefordshire LUG mailing list
> Web: http://www.herefordshire.lug.org.uk
> List: https://mailman.lug.org.uk/mailman/listinfo/herefordshire
More information about the Herefordshire
mailing list