[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 Thursday 26 July 2018 12:51:07 Mark Morgan Lloyd wrote:

> On 26/07/18 16:15, Gene Heskett wrote:
> > On Thursday 26 July 2018 03:06:31 Mark Morgan Lloyd wrote:
> >> On 25/07/18 21:30, Gene Heskett wrote:
> >>> On Wednesday 25 July 2018 16:15:03 Mark Morgan Lloyd wrote:
> >>>> There are still ways of working round that sort of problem. For
> >>>> example, you can copy an entire device using dd to capture boot
> >>>> segments and partition layout, inspect and recreate the
> >>>> filesystems using mkfs, then use [something] to copy files one at
> >>>> a time into the new filesystems taking care that some bootloaders
> >>>> need a wakeup call when a file moves.
> >>>>
> >>>> As far as "something" is concerned:
> >>>>
> >>>> dd: Sector-by-sector copy between devices and files.
> >>>> tar: Good ol' archiver, with directory-exclude etc. options.
> >>>> netpipes: Do a tar or dd over the LAN.
> >>>> rsync: File-by-file copy over LAN.
> >>>> rdist: Ditto, less well-known but with some good points.
> >>>
> >>> I'll have to look at that. I need dd like copies, but I don't
> >>> want /media/slash to be anything but an empty dir in the image it
> >>> makes.
> >>
> >> dd to a file, then use  losetup -f -P  to make the partitions in
> >> that file mountable, mount the appropriate one and delete the stuff
> >> you don't want.
> >
> > 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?

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?

> 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.

> > 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.
>
> > Maybe it would be best if I used the resize utility to resize the /
> > to just over whats used. I've made a copy of /home/pi/linuxcnc, so I
> > at least have the codes I've already written backed up locally.
>
> But you'll still need to unmount / or at the very least go into
> single-user mode or freeze it before you can do anything like that.
>
> > And I've not been able to find, but haven't looked online, a man
> > page for rdist. Now have, but bears a re-read, its nothing like a
> > dd.
>
> As I said above, rdist is comparable with rsync.

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. 

Thanks, Mark.

-- 
Cheers, Gene Heskett
--
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page <http://geneslinuxbox.net:6309/gene>


Reply to: