LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-12-2009, 01:50 PM   #1
babypeng
Member
 
Registered: Nov 2007
Distribution: Puppy
Posts: 45

Rep: Reputation: 15
How to change the a block size on a flush usb disk ?


Hello all,

After my mp3 player stopped playing music,
I would like to use it as a flush usb disk.
I would like to make it bootable.
I can see the device in WinXP and in Linux ,
but I can't access it with GRUB.
GRUB simply does not see it.
I think the cause of the problem is the block size on the flush disk,
which is 2048 (bytes ?) .
I looked for info on how to format the player,
but nothing I found worked.
Gparted and QTparted did not agree to do anything with it,
and I need some assistance with fdisk/cfdisk/sfdisk .

The current block size on the player is 2048,
but I think Linux would prefer it to be 512 or 1024 .

Can anybody explain the logic behind having 512 or 1024 block size ?

following is a redirection of fdisk -l :

---------------------
Note: sector size is 2048 (not 512)
Disk /dev/sda: 998 MB, 998506496 bytes
31 heads,
62 sectors/track,
253 cylinders
Units = cylinders of 1922 * 2048 = 3936256 bytes

Disk identifier: 0x6f20736b

Device------------Boot-----Start------End--------Blocks------Id
System/dev/sda1---------------1------200--------768798-----83
Linux/dev/sda2---------------201------400--------768800----83
Linux/dev/sda3---------------401-----1014-------2360216----83
Linux
---------------------

I was able to redirect the fdisk -l output only by using
my resident installation of Debian single user mode.
I could not redirect the fdisk -l output with Knoppix or with Puppy.
does anybody know why ?


Any help appreciated,


Babypeng
 
Old 06-12-2009, 05:30 PM   #2
NeddySeagoon
Gentoo support team
 
Registered: May 2009
Location: 56N 3W
Distribution: Gentoo
Posts: 178

Rep: Reputation: 41
babypeng,

The block size is not an issue. FLASH uses either a 2k or 4k block size.
The block size is simply the minimum size block that can be written to the device.
Smaller writes must be faked by reading the block, updating it, then writing it back.

Your FLASH should appear as a SCSI drive, Its /dev/sda in your fdisk output above.
grub installs its bootloader into the space before the first partition, which on an mp3 player, may be the player firmware, so you may need some special commands to overwrite that. If you do that, it may not work at all, even as as USB stick any more.

Grub should have no problems attempting the grub install. What errors do you see ?
 
Old 06-12-2009, 06:24 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
I doubt grub (classic) will deal with the sector size being other than 512. Been ages since I looked at the code though.
There is also the possibility the device has an HPA that could be upsetting things as well.
If it were me I'd just dd zeroes over the start of the device - fdisk should then open it and create a partition table. But you'd better not want any of the data on it, and it may just destroy it all together as a working/usable device.
 
Old 06-13-2009, 04:11 AM   #4
babypeng
Member
 
Registered: Nov 2007
Distribution: Puppy
Posts: 45

Original Poster
Rep: Reputation: 15
NeddySeagoon:

I will try it again,
I'll log the error messages,
and post them here.


syg00 :

I will do the "dd zeroes" thing.
The player is not working anyway, so all I got to loose
is a stubby 1GB flush disk.
If I ruin it I will upgrade to a real "Disk On Key"


thank you all,

Babypeng
 
Old 06-15-2009, 02:26 PM   #5
babypeng
Member
 
Registered: Nov 2007
Distribution: Puppy
Posts: 45

Original Poster
Rep: Reputation: 15
Hello All,

I tried the zeroes over the mbr with dd ,
on Knoppix.
I ran the command:
sudo dd if=/dev/zero of=/dev/sda bs=512 count=1
The command ran fine.
I then looked back into the player and nothing changed on it.
The partitions are still there, and the data is still there.
And yes, I am sure the player is sda .
And no, I didn't ruin any other partition on any other
drive on the computer.

1.
Does it mean that I reached the end of the way ?

2.
Does it mean the mbr on the player can not be erased ?

3.
and so, the player can not be made bootable ?


Any help appreciated,

Babypeng
 
Old 06-16-2009, 01:01 PM   #6
NeddySeagoon
Gentoo support team
 
Registered: May 2009
Location: 56N 3W
Distribution: Gentoo
Posts: 178

Rep: Reputation: 41
babypeng,

Please try with larger block sizes, or more sectors or both.
2048 and 4096 are good block sizes for FLASH.

The MBR may be write protected, so to change it you would have to send it the unlocking code before you can use dd. Thats much like a BIOS upgrade program does for your BIOS.

To make it bootable, you do need to rewrite the MBR.
 
Old 06-16-2009, 02:11 PM   #7
babypeng
Member
 
Registered: Nov 2007
Distribution: Puppy
Posts: 45

Original Poster
Rep: Reputation: 15
Hello NeddySeagoon,
Thank you for your response.

My knowledge of the dd command and of linux in general,
is not that big (which is why I post in the newbie forum).

I understand there is no point in running the dd command
with any block size, unless I have the MBR unlocking code
you mentioned.
Well, I don't have that code.
In fact, I have no idea what that code is.
Can you enlighten me on this issue ?

Is that code supposed to be supplied by the manufacturer
of the mp3 player ?

Could it be that that the MBR area of the flush memory
is not writable at all ?

Thank you for your help,

Babypeng
 
Old 06-16-2009, 02:49 PM   #8
BeacoN
Member
 
Registered: Nov 2008
Distribution: Linux Mint
Posts: 56

Rep: Reputation: 17
hey babypeng,

dd doesn't need any speceial code to access the MBR-it looks at bytes. try this command, as long as you're SURE /dev/sda is the flash (for me /dev/sda if my primary hard disk).

sudo dd if=/dev/zero of=/dev/sda bs=2048

that will zero out the whole flash drive-if that doesn't work you're a magician. then you should be able to format it.

*note* for a 1GB disk this command will take maybe an hour or two, be patient.

Last edited by BeacoN; 06-16-2009 at 02:51 PM.
 
Old 06-17-2009, 12:34 PM   #9
NeddySeagoon
Gentoo support team
 
Registered: May 2009
Location: 56N 3W
Distribution: Gentoo
Posts: 178

Rep: Reputation: 41
babypeng,

The unlocking code will be that of the FLASH memory itself. Its determined by the FLASH memory chip designer.
It also has to be written to the right addresses with the right timing. For embedded devices, like mp3 players, which have a 'fixed' program for the player and writable space for your music, the MBR and the mp3 player code may be locked into the device before its put in its case. It may not be possible to unlock it over USB.

You can still use the device as a data storage device but you need to rewrite the MBR to make it bootable
 
Old 06-18-2009, 05:35 PM   #10
babypeng
Member
 
Registered: Nov 2007
Distribution: Puppy
Posts: 45

Original Poster
Rep: Reputation: 15
Hello All,

Hello BeacoN,

My problem is not formating partitions on the player.
The problem I have is in making the Player bootable.
And I just learned from NeddySeagoon that in my particular
case it is not possible.

Hello NeddySeagoon,

Thank you for your response.
With my knowledge of electronics I know
the mbr can be "burned" on a non-rewritable part of the memory,
but I didn't know if that's how they make it on MP3 players.
What you explained is what I suspected.
For me this is the end of the story. I will not be able
to boot it.

Thank you all for your help.

Babypeng
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to change the disk size on the fly? harry2006 Linux - Software 6 11-02-2008 01:17 AM
What size USB disk is boot rescue disk? Lufbery Slackware - Installation 11 12-02-2007 02:36 PM
change disk size after dd honk307 Linux - General 5 08-16-2007 03:50 AM
why we can't change the block size in ext2 filesystem in source code nagesh20k Linux - General 3 08-23-2006 04:47 PM
Disk Block size conversion vikrambhimbar Linux - Hardware 1 04-29-2006 12:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration