Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sun 26 Oct 2014, 04:39
All times are UTC - 4
 Forum index » House Training » Users ( For the regulars )
TestDisk: Flash Drive="CHS and LBA don't match" [SOLVED]
Moderators: Flash, Ian, JohnMurga
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 8 of 11 Posts_count   Goto page: Previous 1, 2, 3, ..., 6, 7, 8, 9, 10, 11 Next
Author Message
linuxcbon

Joined: 09 Aug 2007
Posts: 778

PostPosted: Sun 17 Mar 2013, 06:16    Post_subject:  

fdisk /dev/sdb
Delete partition d 1
Create a new primary partition n p 1
Write to table and quit w q
Then make a FAT32 filesystem mkfs.vfat -F 32 /dev/sdb1
But I guess it is better to use ntfs.
Back to top
View user's profile Send_private_message 
Sylvander

Joined: 15 Dec 2008
Posts: 3463
Location: West Lothian, Scotland, UK

PostPosted: Sun 17 Mar 2013, 07:15    Post_subject:  

linuxcbon:
Here's what I did:
1.
Code:
# fdisk /dev/sdb

Command (m for help): d1
Selected partition 1

Command (m for help): np1
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4, default 1):
Using default value 1
First sector (2048-1974270, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-1974270, default 1974270):
Using default value 1974270

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
# mkfs.vfat -F 32 /dev/sdb1
mkfs.vfat 3.0.11 (24 Dec 2010)
#

Does that look OK?
Should I have included spaces between n p 1 etc?
GParted shows no change to sdb1; partition still has "unknown" filesystem.
Back to top
View user's profile Send_private_message 
linuxcbon

Joined: 09 Aug 2007
Posts: 778

PostPosted: Sun 17 Mar 2013, 07:20    Post_subject:  

It seems all correct.
Always run gparted from shell and tell which error messages.
And you didnt tell what are dmesg final messages.
Back to top
View user's profile Send_private_message 
Sylvander

Joined: 15 Dec 2008
Posts: 3463
Location: West Lothian, Scotland, UK

PostPosted: Sun 17 Mar 2013, 07:23    Post_subject:  

linuxcbon wrote:
you didnt tell what are dmesg final messages.

I don't understand what dmesg is, and what/where is its final messages [more than 1?]
Back to top
View user's profile Send_private_message 
linuxcbon

Joined: 09 Aug 2007
Posts: 778

PostPosted: Sun 17 Mar 2013, 07:41    Post_subject:  

Dmesg is messages from kernel.
Type in shell dmesg and copy here the last 10 lines.
Back to top
View user's profile Send_private_message 
amigo

Joined: 02 Apr 2007
Posts: 2262

PostPosted: Sun 17 Mar 2013, 08:16    Post_subject:  

linuxcbon, you seem to be leading him down the saem (wrong) path as before. fdisk will, by default, create a type 83 partition -he shouldn't then format it as a FAT if the partition type is not right! And, I thought the whole point here was to create an ext2 FS -or have I missed some important posting?

Sylvander, the fdisk commands seems to have succeeded. All you need to do then is use mke2fs or mkfs.ext2 to format the partition (as ext2). You'll then want to run 'fsck -cp /dev/sdb1' to handle the bad blocks.

Don't use gparted as it seems to not work -as it is prone to do...

If you now want the partition as a FAT, please say so. As for ntfs, there is no way to format a partition as NTFS under linux. If that is what you want, then say so -as you will need to *change* the partition type before using windows to format the partition. windows will not recognize partitions of any non-windows type.
Back to top
View user's profile Send_private_message 
rcrsn51


Joined: 05 Sep 2006
Posts: 9207
Location: Stratford, Ontario

PostPosted: Sun 17 Mar 2013, 08:25    Post_subject:  

amigo wrote:
As for ntfs, there is no way to format a partition as NTFS under linux.

mkntfs
Back to top
View user's profile Send_private_message 
linuxcbon

Joined: 09 Aug 2007
Posts: 778

PostPosted: Sun 17 Mar 2013, 08:28    Post_subject:  

amigo you dont need to set the type to format a partition. Gparted works, it's a good program. He wants fat32, not ext2. Yes it is possible possible to format ntfs in linux. What did you say ?
Back to top
View user's profile Send_private_message 
Sylvander

Joined: 15 Dec 2008
Posts: 3463
Location: West Lothian, Scotland, UK

PostPosted: Sun 17 Mar 2013, 09:18    Post_subject:  

At the moment I'll take any filesystem I can get...
Though I'd prefer FAT32.

amigo:
1. Tried this:
[Didn't know what to do with mke2fs, so used mkfs.ext2 instead]
Code:
# fdisk /dev/sdb

Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): d
Selected partition 1

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4, default 1):
Using default value 1
First sector (2048-1974270, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-1974270, default 1974270):
Using default value 1974270

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
# mke2fs
Usage: mke2fs [-c|-l filename] [-b block-size] [-f fragment-size]
   [-i bytes-per-inode] [-I inode-size] [-J journal-options]
   [-G meta group size] [-N number-of-inodes]
   [-m reserved-blocks-percentage] [-o creator-os]
   [-g blocks-per-group] [-L volume-label] [-M last-mounted-directory]
   [-O feature[,...]] [-r fs-revision] [-E extended-option[,...]]
   [-T fs-type] [-U UUID] [-jnqvFKSV] device [blocks-count]
# mkfs.ext2 /dev/sdb1
mke2fs 1.41.14 (22-Dec-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
61568 inodes, 246272 blocks
12313 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=255852544
8 block groups
32768 blocks per group, 32768 fragments per group
7696 inodes per group
Superblock backups stored on blocks:
   32768, 98304, 163840, 229376

Writing inode tables: done                           
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 38 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
# fsck -cp /dev/sdb1
fsck from util-linux 2.19
fsck.ext2: Bad magic number in super-block while trying to open /dev/sdb1
/dev/sdb1:
The superblock could not be read or does not describe a correct ext2
filesystem.  If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
    e2fsck -b 8193 <device>

#


linuxcbon:
2. Last 10 lines of dmesg:
Code:
[ 1183.901557] sd 4:0:0:0: [sdb]  Sense Key : Not Ready [current]
[ 1183.901561] sd 4:0:0:0: [sdb]  Add. Sense: Medium not present
[ 1183.901565] sd 4:0:0:0: [sdb] CDB: Write(10): 2a 00 00 00 08 00 00 00 08 00
[ 1183.901572] end_request: I/O error, dev sdb, sector 2048
[ 1238.334837] sd 4:0:0:0: [sdb] 1974271 512-byte logical blocks: (1.01 GB/963 MiB)
[ 1238.335828] sd 4:0:0:0: [sdb] Asking for cache data failed
[ 1238.335830] sd 4:0:0:0: [sdb] Assuming drive cache: write through
[ 1238.337451] sd 4:0:0:0: [sdb] Asking for cache data failed
[ 1238.337454] sd 4:0:0:0: [sdb] Assuming drive cache: write through
[ 1238.339085]  sdb: sdb1
#
Back to top
View user's profile Send_private_message 
amigo

Joined: 02 Apr 2007
Posts: 2262

PostPosted: Sun 17 Mar 2013, 09:34    Post_subject:  

Really strange that everything seems to succeed until you run fsck... If you can't mount that now, then it is truly trashed. Just for future reference, you said you'd like a FAT filesystem, but then you used mkfs.ext2 to format it. For a FAT, NTFS or other windows filesystem, while running fdisk, use the '-t' option to change the partition type (called 'system id' in the options). You need to do this before trying to format the drive. As I mentioned, if you wanted an NTFS file system, then you'd need to change the partition type (system id) to one of the valid windows types and then use windows to create the filesystem. But, as of now, I'm convinced your drive is trashed.
Back to top
View user's profile Send_private_message 
npierce

Joined: 28 Dec 2009
Posts: 858

PostPosted: Sun 17 Mar 2013, 09:50    Post_subject:  

Neither fdisk nor dd automatically verify their writes.

You can get dd to write to a rock if it believes that it you have write permission to do so. That doesn't mean that anything actually got written to the rock.

Sylvander has a type b FAT32 partition on his flash drive. He has made many good attempts to change the partition table, and has provided the results of his sessions in fdisk so we can see what he has done.

Yes, he can change the partition type or even delete it in the partition table that fdisk holds in memory. And the p command will show that change. And he uses the w command to write the partition table to the drive, and that completes with no error message.

But the table does not get written.

Currently the drive appears to be unwritable, perhaps permanently so. There is a chance that a low level format will restore it, but unfortunately the utility I found doesn't work for him.
Back to top
View user's profile Send_private_message 
amigo

Joined: 02 Apr 2007
Posts: 2262

PostPosted: Sun 17 Mar 2013, 10:05    Post_subject:  

It is also possible that rebooting after writing the partition table may help -sometimes changing the partition type doesn't take effect until after a reboot.
Back to top
View user's profile Send_private_message 
Sylvander

Joined: 15 Dec 2008
Posts: 3463
Location: West Lothian, Scotland, UK

PostPosted: Sun 17 Mar 2013, 12:51    Post_subject:  

npierce:
1. "You can get dd to write to a rock if it believes that it you have write permission to do so. That doesn't mean that anything actually got written to the rock"
I think you're correct in saying that. Very Happy

2. "he uses the w command to write the partition table to the drive, and that completes with no error message"
But, but, but....
When I enter the write command [w], the command console CLOSES! Sad
So I think it likely the changes were NOT written to the drive [because it's READ-ONLY!]

3. "...the table does not get written.
Currently the drive appears to be unwritable...
"
Seems so to me. Sad

4. "There is a chance that a low level format will restore it, but unfortunately the utility I found doesn't work for him"
Sad, but true.

amigo:
5. "It is also possible that rebooting after writing the partition table may help -sometimes changing the partition type doesn't take effect until after a reboot"
I had tried that previously, and it failed...
Probably because the drive cannot be written to [for some reason as yet unproved?]
I've seen at least 1 program report that the drive is read-only.

-------------------------------------------

6. I certainly find this problem very interesting.
I'd love to understand what is really amiss with the drive.
i.e. Why is it unwritable=read-only?
Back to top
View user's profile Send_private_message 
sheldonisaac

Joined: 21 Jun 2009
Posts: 425
Location: Philadelphia, PA

PostPosted: Sun 17 Mar 2013, 14:16    Post_subject: the unwriteable flash drive  

Sylvander wrote:

I'd love to understand what is really amiss with the drive.
i.e. Why is it unwritable=read-only?

I guess this won't help, Sylvander; you probably did all tnis,
and seem to find there's something wrong with your thumb drive?

I have a 512MB SD card Kingston. Sliding lock set to locked. in a USB card reader. Lucid Puppy Linux 5.2.8-005

Code:
~> cp sylpheed.desktop~ /mnt/sdb1/
cp: cannot create regular file `/mnt/sdb1/sylpheed.desktop~': Read-only file system
Set slider to unlocked.
Code:
~> cp sylpheed.desktop~ /mnt/sdb1/
~>

~> ls -lat  /mnt/sdb1/
total 32
drwxr-xr-x  2 root root 16384 2013-03-17 13:43 .
-rwxr-xr-x  1 root root   456 2013-03-17 13:43 sylpheed.desktop~
drwxr-xr-x 15 root root   140 2013-03-17 13:40 ..
~>

~> umount /mnt/sdb1
~>

~> fdisk /dev/sdb

The number of cylinders for this disk is set to 3908.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/sdb: 512 MB, 512229376 bytes
8 heads, 32 sectors/track, 3908 cylinders
Units = cylinders of 256 * 512 = 131072 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1        3908      500203+   6  FAT16

Command (m for help): d
Selected partition 1

Command (m for help): p

Disk /dev/sdb: 512 MB, 512229376 bytes
8 heads, 32 sectors/track, 3908 cylinders
Units = cylinders of 256 * 512 = 131072 bytes

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
~> fdisk /dev/sdb

Command (m for help): p

Disk /dev/sdb: 512 MB, 512229376 bytes
16 heads, 62 sectors/track, 1008 cylinders
Units = cylinders of 992 * 512 = 507904 bytes

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): q

~>

~> dd if=/dev/zero of=/dev/sdb bs=512

dd: writing `/dev/sdb': No space left on device
1000449+0 records in
1000448+0 records out
512229376 bytes (512 MB) copied, 314.13 s, 1.6 MB/s
~>
~> fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): p

Disk /dev/sdb: 512 MB, 512229376 bytes
16 heads, 62 sectors/track, 1008 cylinders
Units = cylinders of 992 * 512 = 507904 bytes

   Device Boot      Start         End      Blocks   Id  System

Command (m for help):  n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1008, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1008, default 1008):
Using default value 1008

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 0C
Changed system type of partition 1 to c (W95 FAT32 (LBA))

Command (m for help): p

Disk /dev/sdb: 512 MB, 512229376 bytes
16 heads, 62 sectors/track, 1008 cylinders
Units = cylinders of 992 * 512 = 507904 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        1008      499937    c  W95 FAT32 (LBA)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.
~> mkfs.vfat /dev/sdb1
mkfs.vfat 3.0.7 (24 Dec 2009)
~>

(now I rebooted)
Code:

 ~> fdisk /dev/sdb

Command (m for help): p

Disk /dev/sdb: 512 MB, 512229376 bytes
16 heads, 62 sectors/track, 1008 cylinders
Units = cylinders of 992 * 512 = 507904 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        1008      499937    c  W95 FAT32 (LBA)

Command (m for help): q

~> mkdir /mnt/sdb1
~> mount -t vfat /dev/sdb1  /mnt/sdb1
~>  cp sylpheed.desktop~ /mnt/sdb1/
~> ls -lta  /mnt/sdb1/
total 24
drwxr-xr-x  2 root root 16384 2013-03-17 14:13 .
-rwxr-xr-x  1 root root   456 2013-03-17 14:13 sylpheed.desktop~
drwxr-xr-x 15 root root   140 2013-03-17 14:12 ..
~>
Back to top
View user's profile Send_private_message 
npierce

Joined: 28 Dec 2009
Posts: 858

PostPosted: Sun 17 Mar 2013, 20:58    Post_subject:  

Sylvander,

I'm looking to see if I can locate a low level format utility that will work with your drive. Could you plug in your drive and then post the output of this command?
Code:
lsusb
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 8 of 11 Posts_count   Goto page: Previous 1, 2, 3, ..., 6, 7, 8, 9, 10, 11 Next
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » House Training » Users ( For the regulars )
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1161s ][ Queries: 13 (0.0085s) ][ GZIP on ]