TestDisk: Flash Drive="CHS and LBA don't match" [SOLVED]
There is no reason why any file manager or the cp utility wouldn't copy to /mnt/sdb1, if that directory exists and is writable by you (which it should be if you are root). But that doesn't mean that it is copying the file to your drive. If the drive couldn't be mounted, then /mnt/sdb1 is just another sub-directory of the /mnt directory.Sylvander wrote:sdb1 won't mount, mind you, Xfe IS able to see /mnt/sdb1, and Xfe DID succeed in copying a file to /mnt/sdb1, and I WAS able to open the text file [a .log file] using Geany.
How come?
If the file is still in /mnt/sdb1, you will probably find that the file will still be there even after physically removing your flash drive. In fact, if you ever succeed in mounting a flash drive on /mnt/sdb1, the file will no longer be visible -- at least not until you unmount the drive.
proebler:
1. suggest to use the Mint disk utility
Tried to, but couldn't find anything named "disk utility" within the Mint environment.
Where is it located?
Does it come natively included, or would I need to install it?
2. using testdisk, > Delete all data in partition table
then...
I'll attempt that ASAP.
Semme:
3. Console mount? Possibly >> mount -t vfat /dev/sdb1 /mnt/sdb1
Tried that and got...
npierce
Thanks for the explanation.
I believe I understand what you said.
It is my routine, when session changes are made...
To NOT auto save [back to the lupusave], or manually save, DURING the session.
And...
To NOT save at shutdown/reboot either.
Hence, if [during the session] the file was saved within the filesystem held in RAM...
It would be lost at shutdown, hence no longer exists.
I'm very grateful for all the assistance guys!
1. suggest to use the Mint disk utility
Tried to, but couldn't find anything named "disk utility" within the Mint environment.
Where is it located?
Does it come natively included, or would I need to install it?
2. using testdisk, > Delete all data in partition table
then...
I'll attempt that ASAP.
Semme:
3. Console mount? Possibly >> mount -t vfat /dev/sdb1 /mnt/sdb1
Tried that and got...
Code: Select all
# mount -t vfat /dev/sdb1 /mnt/sdb1
mount: mount point /mnt/sdb1 does not exist
#
Thanks for the explanation.
I believe I understand what you said.
It is my routine, when session changes are made...
To NOT auto save [back to the lupusave], or manually save, DURING the session.
And...
To NOT save at shutdown/reboot either.
Hence, if [during the session] the file was saved within the filesystem held in RAM...
It would be lost at shutdown, hence no longer exists.
I'm very grateful for all the assistance guys!
No sdb1? Create one.. any folder for that matter.
If it were >> /root/test_mount >> you would:
Check it.. We have files?
==
And I doubt "disk utility" is the name of the program..
Pretty sure they meant Mints`partitioning utility.
Oop's.. maybe it is Disk Utility?
Shell >> gnome-disk-utility.
If it were >> /root/test_mount >> you would:
Code: Select all
mount -t vfat /dev/sdb1 /root/test_mount
==
And I doubt "disk utility" is the name of the program..
Pretty sure they meant Mints`partitioning utility.
Oop's.. maybe it is Disk Utility?
Shell >> gnome-disk-utility.
Semme:
1. "No sdb1? Create one.. any folder for that matter."
How?
You didn't explicitly say I should do it as follows...
2. "If it were >> /root/test_mount >> you would:
Code:
mount -t vfat /dev/sdb1 /root/test_mount"
Did this and got:
proebler:
3. "using testdisk, > Delete all data in partition table
then"
Did this, and it appeared to succeed, but subsequent operations failed, which suggests it really didn't succeed.
4. "using Gparted [Puppy], > Write partition table [Devices tab]
or
using Pdisk [Puppy, System] > fdisk > create new empty DOS partition table"
Both of these operations failed.
1. "No sdb1? Create one.. any folder for that matter."
How?
You didn't explicitly say I should do it as follows...
2. "If it were >> /root/test_mount >> you would:
Code:
mount -t vfat /dev/sdb1 /root/test_mount"
Did this and got:
Code: Select all
# mount -t vfat /dev/sdb1 /root/test_mount
mount: mount point /root/test_mount does not exist
#
3. "using testdisk, > Delete all data in partition table
then"
Did this, and it appeared to succeed, but subsequent operations failed, which suggests it really didn't succeed.
4. "using Gparted [Puppy], > Write partition table [Devices tab]
or
using Pdisk [Puppy, System] > fdisk > create new empty DOS partition table"
Both of these operations failed.
I think I can provide some insight here as I have an unusual flash drive which illustrates something. Like most new flash drives it was formatted as FAT32. I later re-formatted it to ext2 -but without changing the partition type. Now, it can be mounted as either FAT32 or ext2 -the formatting markers for ext2 did not destroy all old markers for FAT32. If I mount it as a FAT, I can see sertain files which I added when it was *formatted* as FAT. But, if I mount it as an ext2 FS, then I can see other files which I added to it when t was mounted as an ext2... but not the files that are from the 'FAT times'.
Anyway, it shows that you can really have weird things happen. The partition type is not always exclusive to a certain filesystem type. But, inconsistencies can confuse other tools -like mount, etc. Like in my case, if mount is called without specifying the filesystem type, then it goes through the list of supported file systems and tries each one till it succeeds. mount also does this when an fstab entry for the partition has 'auto' as the filesystem type.
So, the OP has managed to create a drive similar to what I have. The way to rectify it is this:
Do not mount the drive for fdisk operations! If it is already mounted, then unmount it first.
1. Run fdisk and change the partition type by choosing option 't', choosing the right partition number (1 in OP'S case) and selecting 'L' to show the table illustrated earlier:
For a new FAT32 filesystem, you should choose type 'c' or possibly 'b'. You could also run 'fidsk -l' to check the partition type first.
Once the partition *type* is right. Then format the new partition using mkdosfs:
mkdosfs -F 32 /dev/sdb1
Only now can you mount and use the filesystem. And, it would be good to specify the filesystem type when mounting:
mount -t vfat /dev/sdb1 /mnt/wherever
Remember, the partitioning and filesystem creation should be done with the drive unmounted.
Anyway, it shows that you can really have weird things happen. The partition type is not always exclusive to a certain filesystem type. But, inconsistencies can confuse other tools -like mount, etc. Like in my case, if mount is called without specifying the filesystem type, then it goes through the list of supported file systems and tries each one till it succeeds. mount also does this when an fstab entry for the partition has 'auto' as the filesystem type.
So, the OP has managed to create a drive similar to what I have. The way to rectify it is this:
Do not mount the drive for fdisk operations! If it is already mounted, then unmount it first.
1. Run fdisk and change the partition type by choosing option 't', choosing the right partition number (1 in OP'S case) and selecting 'L' to show the table illustrated earlier:
Code: Select all
Hex code (type L to list codes): LL^H
0 Empty 24 NEC DOS 81 Minix / old Lin bf Solaris
1 FAT12 39 Plan 9 82 Linux swap c1 DRDOS/sec (FAT-
2 XENIX root 3c PartitionMagic 83 Linux c4 DRDOS/sec (FAT-
3 XENIX usr 40 Venix 80286 84 OS/2 hidden C: c6 DRDOS/sec (FAT-
4 FAT16 <32M 41 PPC PReP Boot 85 Linux extended c7 Syrinx
5 Extended 42 SFS 86 NTFS volume set da Non-FS data
6 FAT16 4d QNX4.x 87 NTFS volume set db CP/M / CTOS / .
7 HPFS/NTFS 4e QNX4.x 2nd part 88 Linux plaintext de Dell Utility
8 AIX 4f QNX4.x 3rd part 8e Linux LVM df BootIt
9 AIX bootable 50 OnTrack DM 93 Amoeba e1 DOS access
a OS/2 Boot Manag 51 OnTrack DM6 Aux 94 Amoeba BBT e3 DOS R/O
b W95 FAT32 52 CP/M 9f BSD/OS e4 SpeedStor
c W95 FAT32 (LBA) 53 OnTrack DM6 Aux a0 IBM Thinkpad hi eb BeOS fs
e W95 FAT16 (LBA) 54 OnTrackDM6 a5 FreeBSD ee GPT
f W95 Ext'd (LBA) 55 EZ-Drive a6 OpenBSD ef EFI (FAT-12/16/
10 OPUS 56 Golden Bow a7 NeXTSTEP f0 Linux/PA-RISC b
11 Hidden FAT12 5c Priam Edisk a8 Darwin UFS f1 SpeedStor
12 Compaq diagnost 61 SpeedStor a9 NetBSD f4 SpeedStor
14 Hidden FAT16 <3 63 GNU HURD or Sys ab Darwin boot f2 DOS secondary
16 Hidden FAT16 64 Novell Netware af HFS / HFS+ fb VMware VMFS
17 Hidden HPFS/NTF 65 Novell Netware b7 BSDI fs fc VMware VMKCORE
18 AST SmartSleep 70 DiskSecure Mult b8 BSDI swap fd Linux raid auto
1b Hidden W95 FAT3 75 PC/IX bb Boot Wizard hid fe LANstep
1c Hidden W95 FAT3 80 Old Minix be Solaris boot ff BBT
1e Hidden W95 FAT1
Once the partition *type* is right. Then format the new partition using mkdosfs:
mkdosfs -F 32 /dev/sdb1
Only now can you mount and use the filesystem. And, it would be good to specify the filesystem type when mounting:
mount -t vfat /dev/sdb1 /mnt/wherever
Remember, the partitioning and filesystem creation should be done with the drive unmounted.
amigo:
1. Followed your instructions [correctly I hope], and got the following:
Any useful info there?
Before entering the above command I checked, and /mnt/sdb1 did in fact exist.
I had chosen to make partition type c=W95 FAT32 (LBA).
Hope this was the correct choice.
proebler:
Will now reboot into Mint, and look for Disk Utility.
Done: No Disk Utility in Accessories!
Will make new Mint=Debian-xfce bootable DVD-RW, and try in there.
Got a link for the Debian-xfce iso file?
1. Followed your instructions [correctly I hope], and got the following:
Any useful info there?
Code: Select all
# mount -t vfat /dev/sdb1 /mnt/sdb1
mount: wrong fs type, bad option, bad superblock on /dev/sdb1,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
#
I had chosen to make partition type c=W95 FAT32 (LBA).
Hope this was the correct choice.
proebler:
Will now reboot into Mint, and look for Disk Utility.
Done: No Disk Utility in Accessories!
Will make new Mint=Debian-xfce bootable DVD-RW, and try in there.
Got a link for the Debian-xfce iso file?
Sylvander- go ahead and fdisk your device again- we won't write to it.
Once up, type *p* to dump the partition table. What's the *Id* read?
To quit without write >> *q*
PS- You don't need Mint to zero your drive.
Once up, type *p* to dump the partition table. What's the *Id* read?
To quit without write >> *q*
PS- You don't need Mint to zero your drive.
Semme:
1.
Here's the result:
2.
Hmmm, how do I create the junk.bin file on sdb1 if I cannot mount sdb1?
proebler:
3.
I'm certainly getting around.
1.
Done.Semme wrote:Once up, type *p* to dump the partition table. What's the *Id* read?
Here's the result:
Code: Select all
Command (m for help): p
Disk /dev/sdb: 1010 MB, 1010826752 bytes
196 heads, 9 sectors/track, 1119 cylinders, total 1974271 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0009dcf9
Device Boot Start End Blocks Id System
/dev/sdb1 2048 1972223 985088 b W95 FAT32
Thanks, I'll try using these instructions to zero the drive.Semme wrote:You don't need Mint to zero your drive.
Hmmm, how do I create the junk.bin file on sdb1 if I cannot mount sdb1?
proebler:
3.
In "linuxmint-xfce-201104-dvd-64bit", I found it in "System", but it failed to complete all the operations I tried [format drive, format partition, delete partition].proebler wrote:Disk Utility is in Accessories...
I'm certainly getting around.
Hold up on that zero link. I recall there being a typo..
Not sure why, but your sector size looks odd. Hmm..
Ah, yes- it's the format me thinks..
Haven't seen FAT in a while.
==
fdisk can alter cylinders, heads and sectors?
:idea: <rubs hands together> Hmm..
==
Ya know- how about an fsck?
Format switch ext2/3..
e2fsck *
Then back >> FAT32.
Just think'n..
==
Aha! You've got an old boot sector on this drive!
mount -t vfat >> bad superblock? I think NOT!
Not sure why, but your sector size looks odd. Hmm..
Ah, yes- it's the format me thinks..
Haven't seen FAT in a while.
==
fdisk can alter cylinders, heads and sectors?
:idea: <rubs hands together> Hmm..
==
Ya know- how about an fsck?
Format switch ext2/3..
e2fsck *
Then back >> FAT32.
Just think'n..
==
Aha! You've got an old boot sector on this drive!
mount -t vfat >> bad superblock? I think NOT!
sorry, but what is the problem?
I'm confused.
Does the device still not work?
The output from fdisk looks reasonable.
This is an USB flash drive, not a HD.
Heads, sectors/track cylinders, are meaningless.
This is from one of my own USB's, it works, mounts and shows perfectly.
It is bootable, as indicated by the *, but that is no necessity.
..or this, from a single partition 8 GB USB.
It too works and mounts correctly but Gparted cannot make sense of it. It is not bootable.
I'm confused.
Does the device still not work?
The output from fdisk looks reasonable.
Code: Select all
Command (m for help): p
Disk /dev/sdb: 1010 MB, 1010826752 bytes
196 heads, 9 sectors/track, 1119 cylinders, total 1974271 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0009dcf9
Device Boot Start End Blocks Id System
/dev/sdb1 2048 1972223 985088 b W95 FAT32
Heads, sectors/track cylinders, are meaningless.
This is from one of my own USB's, it works, mounts and shows perfectly.
It is bootable, as indicated by the *, but that is no necessity.
Code: Select all
Command (m for help): p
Disk /dev/sdb: 4083 MB, 4083351552 bytes
126 heads, 62 sectors/track, 1020 cylinders, total 7975296 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000139ca
Device Boot Start End Blocks Id System
/dev/sdb1 * 2048 3729407 1863680 83 Linux
/dev/sdb2 3729408 7450623 1860608 83 Linux
/dev/sdb3 7450624 7974911 262144 b W95 FAT32
..or this, from a single partition 8 GB USB.
It too works and mounts correctly but Gparted cannot make sense of it. It is not bootable.
Code: Select all
Command (m for help): p
Disk /dev/sdc: 8086 MB, 8086618112 bytes
249 heads, 62 sectors/track, 1023 cylinders, total 15794176 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x2c6b7369
This doesn't look like a partition table
Probably you selected the wrong device.
Device Boot Start End Blocks Id System
/dev/sdc1 ? 1936028272 3787887330 925929529+ 68 Unknown
/dev/sdc2 ? 1330184192 1869160479 269488144 79 Unknown
/dev/sdc3 ? 538989391 1937352302 699181456 53 OnTrack DM6 Aux3
/dev/sdc4 ? 1394627663 1394648999 10668+ 49 Unknown
Partition table entries are not in disk order
Since you got had the "CHS and LBA don't match" error message, it could be helpful to see the raw partition table. This can be done as follows:
First, just to be sure that your Puppy can still find your flash drive as /dev/sdb, and to be sure nothing has changed, enter this command:
If you still get "Disk /dev/sdb: 1010 MB, 1010826752 bytes . . .", enter this command line:
As you are probably aware, it is always good to know what you are doing with the dd command, since a typo can be a dangerous thing. So I'll explain what that line does.
The partition table is 64 bytes in length and lives 446 bytes from the beginning of your drive.
if=/dev/sdb means dd will take its input from /dev/sdb, currently your flash drive.
bs=1 means dd will work in units of one-byte blocks.
skip=446 means dd will skip the first 446 units of input.
count=64 means dd will copy the next 64 units.
2>/dev/null suppresses the status message from dd.
| hexdump -C pipes the output from dd to hexdump, which displays the byte values.
(This command doesn't write to your flash drive, it only reads from it.)
This should display four lines of sixteen bytes each. These are the four entries in the partition table. Please post that output as well as the output from the above "fdisk -l /dev/sdb" command.
First, just to be sure that your Puppy can still find your flash drive as /dev/sdb, and to be sure nothing has changed, enter this command:
Code: Select all
fdisk -l /dev/sdb
Code: Select all
dd if=/dev/sdb bs=1 skip=446 count=64 2>/dev/null | hexdump -C
The partition table is 64 bytes in length and lives 446 bytes from the beginning of your drive.
if=/dev/sdb means dd will take its input from /dev/sdb, currently your flash drive.
bs=1 means dd will work in units of one-byte blocks.
skip=446 means dd will skip the first 446 units of input.
count=64 means dd will copy the next 64 units.
2>/dev/null suppresses the status message from dd.
| hexdump -C pipes the output from dd to hexdump, which displays the byte values.
(This command doesn't write to your flash drive, it only reads from it.)
This should display four lines of sixteen bytes each. These are the four entries in the partition table. Please post that output as well as the output from the above "fdisk -l /dev/sdb" command.