experchange > ubuntu

RobH (11-08-18, 10:34 PM)
I burned an image of motioneyesos for a Pi Zero project, the instered
the sd card in the Pi Zero, and powered up. Nothing, no flashing led or
anything else.
I took the card out and put into a usb adaptor to try and see what was
wrong.

After going through the steps below, I hit a wall.

plug the bad sdcard into the sdcard adapter
then
sudo fdisk -l
does this show the sdcard ?
then mount the relevant drives i.e.
sudo mount /dec/sda4 /mnt
ls -l /mnt

I see the card here:
/dev/sdc6 3873761280 3907028991 33267712 15.9G b W95 FAT32

When try:
sudo mount /dev/sd6 /mnt
mount: /mnt: special device /dev/sd6 does not exist.

So I go to /mnt and mkdir dev
then mkdir sd6

That didn't work, so I mkdir /dev and /sdc6 under /mnt/media/sdcard

Then try:
sudo mount /dev/sd6 /mnt/media/dev/sdc6
mount: /mnt/media/dev/sdc6: mount point does not exist.

I'm doing something wrong or I have missed something here.

Why I want to mount the sdcard is so I can get the whole 16Gb and re
image it and try again.
Jonathan N. Little (11-08-18, 10:45 PM)
RobH wrote:
[..]
> /dev/sdc6       3873761280 3907028991   33267712  15.9G  b W95 FAT32
> When  try:
>  sudo mount /dev/sd6 /mnt ^^^


> mount: /mnt: special device /dev/sd6 does not exist.
> So I go to /mnt and mkdir dev
> then mkdir sd6


Typo? sd6? devices sdX with partitions sdX#

> That didn't work, so I mkdir /dev and /sdc6 under /mnt/media/sdcard


Why?

> Then try:
> sudo mount /dev/sd6 /mnt/media/dev/sdc6
> mount: /mnt/media/dev/sdc6: mount point does not exist.


Again, typo? sdc6 not sd6
Jonathan N. Little (11-08-18, 10:55 PM)
Jonathan N. Little wrote:
> RobH wrote:
> ^^^


Maybe you should list your drives and partitions FIRST to make sure of
your command syntax

lsblk -l
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdb 8:16 0 372.6G 0 disk
sdb2 8:18 0 1K 0 part
sdb5 8:21 0 291.1G 0 part /home
sdb1 8:17 0 71.3G 0 part /mnt/reserve
sdb6 8:22 0 10.3G 0 part [SWAP]
sr0 11:0 1 1024M 0 rom
sda 8:0 0 111.8G 0 disk
sda1 8:1 0 111.8G 0 part /
RobH (11-08-18, 10:58 PM)
On 08/11/2018 20:45, Jonathan N. Little wrote:
> RobH wrote:
> ^^^
> Typo? sd6? devices sdX with partitions sdX#
> Why?
> Again, typo? sdc6 not sd6


The card has mounted now.
Jonathan N. Little (11-08-18, 11:41 PM)
RobH wrote:
> ooops, yes many big typos, doh!
> The card has mounted now.


The command line is very powerful and efficient, but requires accuracy.
If at first you don't succeed, try, try checking your syntax... ;-)

TIP: use the lsblk command first to id drives and partitions.
RobH (11-09-18, 11:54 AM)
On 08/11/2018 21:41, Jonathan N. Little wrote:
> RobH wrote:
>> ooops, yes many big typos, doh!
>> The card has mounted now.

> The command line is very powerful and efficient, but requires accuracy.
> If at first you don't succeed, try, try checking your syntax... ;-)
> TIP: use the lsblk command first to id drives and partitions.

Thanks for that one. I knew it was sdc6, but my fingers were losing
connection to the processor.
RobH (11-09-18, 12:07 PM)
On 09/11/2018 09:54, RobH wrote:
> On 08/11/2018 21:41, Jonathan N. Little wrote:
> Thanks for that one. I knew it was sdc6, but my fingers were losing
> connection to the processor.


Just out of interest, now the card is mounted, and I also have been
reading thought this:



Is there any way to see the data, corrupt or not on the card. Presently
nautilus does not see it.

Thanks
Paul (11-09-18, 01:59 PM)
RobH wrote:
> On 09/11/2018 09:54, RobH wrote:
> Just out of interest, now the card is mounted, and I also have been
> reading thought this:
>
> Is there any way to see the data, corrupt or not on the card. Presently
> nautilus does not see it.
> Thanks


I hope you weren't expecting an easy-peasy time of it :-)

When a file system is toasted, you've got lots of potential
work ahead of you.

*******

Testdisk has a List option, which can list files
on a volume.

However, if the file system is actually damaged,
there's no particular reason for a List/Copy attempt
via TestDisk, to work. TestDisk works well if the
MBR got zapped, and the "pointer" to the file system
was lost. But actual file system corruption, you
can't expect TestDisk to pull a rabbit out of a hat.

We know your MBR is OK, because you mounted the volume
and didn't receive an error message.

You can play with TestDisk if you want. But if it
was me, I'd move on to the next section...

*******

I always recommend a block-level backup, which
avoids file systems entirely, and ensures you
get as much of the information for later work, as
possible. I wouldn't try fsck directly on the
device, if the current benchmark on the devlce is
low.

I've had a couple modern flash devices, where
one half of the flash is non-responsive (the upper
half), and the lower half runs at maybe 2-3MB/sec.
At that point in time, it's pretty well too late.

You may have already observed it's just about
croaked, in which case you shouldn't get your
hopes up.

A sector level transfer test ("dd"), while
watching the rate it achieves with "iotop",
will give you some idea whether the hardware
is healthy (normal transfer rate), or the
transfer rate is 2-3MB/sec and death is
imminent.

sudo dd if=/dev/sdc of=/home/robh/mysd.img

There is a blocksize and count parameter for the
command, which when tuned properly, gives about
3X better transfer rates.

*******

Your device might look like this. The disktype
program can help verify what's on there. No sudo
is needed here, since now the block file is just
a file, and is not down in /dev.

disktype /home/robh/mysd.img

The entire storage device, might look like this.

+-----+-------------+--------------------------------+
| MBR | first_track | actual_file_system_starts_here |
+-----+-------------+--------------------------------+

If you backup like this

sudo dd if=/dev/sdc of=/home/robh/mysd.img

you need to chop off the first xx bytes, so that a
second .img file looks like this. Maybe this is
mysd_fs.img . You'd want it to look like this, so you
could use fsck on the .img file.

+--------------------------------+
| actual_file_system_starts_here |
+--------------------------------+

When it's shaped like that, then

e2fsck mysd_fs.img

will work. If you leave the MBR on it, then
fsck might not be smart enough to "scan" for the
first sector of the file system. The command doesn't
appear to have a byte_offset option that I could see.

If you did the backup like this, this tells "dd"
to copy the first partition. Which is
"actual_file_system_starts_here".

sudo dd if=/dev/sdc1 of=/home/robh/mysd_fs.img

then you get this automatically. But, it's missing
an MBR and the stage 1.5 of GRUB in the first_track.
In other words, this backup is "good for fsck",
"bad for making a new bootable SD".

+--------------------------------+
| actual_file_system_starts_here |
+--------------------------------+

With some care (and good math skills), you can bolt
together bits and pieces as required. And build a
new one of these.

+-----+-------------+--------------------------------+
| MBR | first_track | actual_file_system_starts_here |
+-----+-------------+--------------------------------+

The mount command, actually accepts an offset, and
will accept a rather large offset too. I've used that
before when loopback mounting (mounting a partition
located above the 2.2TB mark). But not every
command you might want to use, has a byte_offset
capability, and then you're forced into some
"fun" manipulations with disk dump ("dd") or
some kind of hex editor.

This kind of work will grow hair on your knuckles.

HTH,
Paul
RobH (11-09-18, 10:33 PM)
On 09/11/2018 11:59, Paul wrote:
[..]
> This kind of work will grow hair on your knuckles.
> HTH,
>     Paul


The command re dd managed to write and image file from the sdcard, but
that was unreadable, so the card is in the bin, and have ordered another
one.

Thanks
wicklowham (11-09-18, 10:46 PM)
On 09/11/2018 20:33, RobH wrote:
> The command re dd managed to write and image file from the sdcard, but
> that was unreadable, so the card is in the bin, and have ordered another
> one. ===========


Did you try to re-format the SD card ,accepting that the files on it
were corrupted and after that tried to load other files ?

Frank , in County Wicklow -Ireland
Jonathan N. Little (11-09-18, 11:16 PM)
RobH wrote:

> The command re dd managed to write and image file from the sdcard, but
> that was unreadable, so the card is in the bin, and have ordered another
> one.


Did you ever check to see if the sdcard is *real* and the size that it
purports to be?

f3 utility
RobH (11-10-18, 12:51 AM)
On 09/11/2018 20:46, wicklowham wrote:
> On 09/11/2018 20:33, RobH wrote:
> ===========
> Did you try to re-format the SD card ,accepting that the files on it
> were corrupted and after that tried to load other files ?
> Frank      ,    in County Wicklow -Ireland


Nah, it was a waste of time as there was only 30mb available as well as
0mb volumes
RobH (11-10-18, 12:55 AM)
On 09/11/2018 21:16, Jonathan N. Little wrote:
> RobH wrote:
> Did you ever check to see if the sdcard is *real* and the size that it
> purports to be?
> f3 utility


No I didn't , but I'll give it a go later
Jonathan N. Little (11-10-18, 01:54 AM)
RobH wrote:
> On 09/11/2018 21:16, Jonathan N. Little wrote:
> No I didn't , but I'll give it a go later


It could explain the errors that you are getting.
RobH (11-10-18, 05:20 PM)
On 09/11/2018 23:54, Jonathan N. Little wrote:
> RobH wrote:
> It could explain the errors that you are getting. I can't get f3write to actually do anything:


/f3-7.1$ f3write /dev/sdc6
F3 write 7.1
Copyright (C) 2010 Digirati Internet LTDA.
This is free software; see the source for copying conditions.

f3write: Can't open path /dev/sdc6: Not a directory

sdc6 is in the /dev directory, so I'm doing something wrong.

Similar Threads