[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: ODROID XU4 and UEFI - Re: Cautionary tale: how to kill an SDCard with one simple command



On 26/07/18 17:45, Gene Heskett wrote:
On Thursday 26 July 2018 12:51:07 Mark Morgan Lloyd wrote:

Wouldn't the file, if put on /media/slash, it seems dd would
include /media/slash in that file, and the result even if it didn't
get into a recursion forever loop, would still be around 10GB bigger
than media//slash, and it already has some stuff  on it:

I was assuming that you weren't trying to dd to something on the same
physical device... which would be highly inadvisable if not impossible
since you need to put what you're copying from into a quiescent state
(i.e. single user or as Adam pointed out fsfreeze.

Not from-to the same device, / is a 32Gb u-sd card its currently booting
from, and /media/slash is /dev/sda3, hooked up by a usb-3<->sata adapter
plugged into a usb-2 port. But the /media mount point is in the u-sd
file structure. Would dd follow that into the files that are there on
the SSD?

No, dd is copying the device not the files it contains, so is completely oblivious of mounts etc.

There is supposed to be a flag that can make the pi-3b boot from an
attached hard drive, but I have never had the command to flip it, work
always a permissions error or something.  Early pi's don't have it?

Recap: RPi3 has a 32Kb ROM (not Flash) containing boot code. Depending on what it reads from one-time programmable storage, it either boots from SDCard, or it also tries to look at USB mass-storage devices or LAN. External boot is disabled by default, and on the original RPi3 is still a bit flaky... my desktop RPi boots from a Maxstor disc via a Newlink hub but I've had limited success with other combinations.

The OTP may also be set so that the boot code in ROM reads some GPIO pins to determine whence to boot, but I've not played with that.

-----8<-----
[Add] program_usb_boot_mode=1 to the end of /boot/config.txt. Reboot the Raspberry Pi with sudo reboot. Once the client Raspberry Pi has rebooted, check that the OTP has been programmed with:

$ vcgencmd otp_dump | grep 17:
17:3020000a

Ensure the output 0x3020000a is correct.

The client configuration is almost done. The final thing to do is to remove the program_usb_boot_mode line from config.txt (make sure there is no blank line at the end).
----->8-----

Plus plenty of other stuff if you Google.

So either get another temporary device and connect it via USB, or use
dd+netpipes to copy the device onto a different system over the LAN.

or sshfs. I don't currently have it setup so root can use it though, just
me is all.

No. dd DOES NOT copy the content of a filesystem, it copies the entire filesystem /or/ the entire partition /or/ the entire device.

I need dd like to preserve the file addresses in /boot as I've read
they are expected to be at fixed addresses with this boot method.

There's usually something that can't easily be moved, unless there's a
loader in ROM with enough smarts to be able to drive a FAT (etc.)
filesystem.

Which I don't believe the pi-3b has.

It does, see above.

So I'd best pull that sd card, put it in a reader and dd it to a file,
then dd that file back to a 64 Gb sd just to make a backup copy? I'll
need a few more 64Gb's just to have working room.

For removable devices... yes, that's the easiest way. However (a) this might surprise you but keeping an image of an SDCard is an entirely adequate backup and (b) when you do write one back to a card note my earlier comments about possibly needing to reduce its size slightly since you can't rely on all "64Gb" cards having exactly the same number of sectors.

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]


Reply to: