Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Jul 2017 22:00:16 +0200
From:      Polytropon <freebsd@edvax.de>
To:        byrnejb@harte-lyne.ca
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Unable to mount USB Flash memory created on CentOS
Message-ID:  <20170728220016.21aa7c83.freebsd@edvax.de>
In-Reply-To: <32ee693f24a1725290b47822cfd8bc9e.squirrel@webmail.harte-lyne.ca>
References:  <aa1eadff2a815bacb69dc015b4aa1f4f.squirrel@webmail.harte-lyne.ca> <20170728205144.c1fc18df.freebsd@edvax.de> <4a5c3fd942ff8566eefaaf9c990abba0.squirrel@webmail.harte-lyne.ca> <20170728212432.7be758bc.freebsd@edvax.de> <32ee693f24a1725290b47822cfd8bc9e.squirrel@webmail.harte-lyne.ca>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 28 Jul 2017 15:37:05 -0400, James B. Byrne wrote:
> 
> On Fri, July 28, 2017 15:24, Polytropon wrote:
> >> > Is the USB stick (usually /dev/da0 or /dev/da0s1 or something
> >> > like that) _really_ mounted?
> >>
> >> Not that I can see. That appears to be the essence of the problem.
> >
> > Can you _manually_ mount the USB stick? For example, with
> > something like
> >
> > 	% mount -t ext2fs -o ro /dev/da0 /media/da0
> >
> mount -t ext2fs -o ro /dev/da0 /media/da0
> mount: /media/da0: No such file or directory

Okay, so the USB stick detaches by itself - as you said you did
not remove it (mechanically) from the system.

Does this happen after a certain time, of as soon as you try to
mount from it? You can easily tell if you open an additional
terminal and run the command

	% tail -F /var/log/message

Now insert the USB stick again and see _when_ it detaches. It
might help if you do this again without being logged in to a
desktop environment, i. e., log out, and change to the text
mode console. Then insert again, do nothing for some time (to
see if the stick detaches after some delay), and then try to
mount manually from another virtual terminal, observing the
kernel messages (to see if the stick detaches when you try
to mount).



> > No matter if the file browser will automatically open a window for
> > /media/da0 (in this example), you can check again the output of
> >
> > 	% mount -v | grep da0
> >
> 
> #  mount -v | grep da0
> #

Not mounted at all.



> > and of course
> >
> > 	% ls /media/da0
> >
> > to see if the files you are expecting are really there.
> >
> 
> # ls /media/da0
> ls: /media/da0: No such file or directory
> # ls /media/
> #

No mountpoint has been created. As I said, it will be created
by the automounter according to the device name, that's why it's
totally okay that no entry is provided in /etc/fstab for this
kind of removable media.



> >> > Check what's on the USB stick, using
> >> >
> >> > 	% gpart show da0
> >> >
> >> # gpart show da0
> >> =>       63  122915265  da0  MBR  (59G)
> >>          63       8001       - free -  (3.9M)
> >>        8064  122907264    1  !12  [active]  (59G)
> >
> > Hmmm... that looks really strange... check with "old-fashioned"
> > fdisk again:
> >
> > 	% fdisk da0
> 
> # fdisk da0
> ******* Working on device /dev/da0 *******
> parameters extracted from in-core disklabel are:
> cylinders=7651 heads=255 sectors/track=63 (16065 blks/cyl)
> 
> Figures below won't work with BIOS for partitions not in cyl 1
> parameters to be used for BIOS calculations are:
> cylinders=7651 heads=255 sectors/track=63 (16065 blks/cyl)
> 
> Media sector size is 512
> Warning: BIOS sector numbering starts with sector 1
> Information from DOS bootblock is:
> The data for partition 1 is:
> sysid 12 (0x0c),(DOS or Windows 95 with 32 bit FAT (LBA))
>     start 8064, size 122907264 (60013 Meg), flag 80 (active)
> 	beg: cyl 1/ head 0/ sector 1;
> 	end: cyl 905/ head 60/ sector 61
> The data for partition 2 is:
> <UNUSED>
> The data for partition 3 is:
> <UNUSED>
> The data for partition 4 is:
> <UNUSED>

That isn't an ext2 file system... again, I'd like to guess that
the partitioning data is damaged, which would at least explain
the inability to mount, but not the detaching you've seen.



> > Is there an ext2 partition? The output you presented looks like
> > a situation where there's nothing the system can automatically
> > detect and mount.
> 
> Well, this exact usb stick was mounted and working up to the point
> that I inserted a second one.  I have moved files from and to the
> device earlier today.

Maybe a clean unmount (or detach?) has damaged essential data?



> > (I don't have an ext2 USB stick at hand so I cannot check how
> > the gpart and fdisk output should look like for a valid TOC with
> > an ext2 partition.)
> >
> > Can you re-initialize the USB stick on the Linux system? Just in
> > case partitioning data has been damaged...
> >
> 
> No, I cannot.  The stick contains my backup of the critical data from
> my original workstation that was dying and has since passed on.

That's why it's important to use -o ro whenever you want to retrieve
files from a backup media. After success, mounting -o rw again is
possible (in case you want to delete the files you no longer need).



> The
> contents were moved to the device using rsync.  This USB key was used
> straight from a sealed package and I did not format it.

And rsync relies on a mounted device, at least read-only. It seems
that something has gone really wrong. If this has something to do
with an additional USB stick being inserted... I can only guess...
the automount magic of the desktop did something really stupid?
Mounting all stuff read-write? Then detach? Hmmm... it's actually
hard to tell what happened, but the result more or less clearly
states that there is no ext2 partition anymore...

After re-initialization of the USB stick, it should mount again.
However, the surprising detach is still a mystery.



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170728220016.21aa7c83.freebsd>