How to change the a block size on a flush usb disk ?
Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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 ?
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 ?
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.
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"
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 ?
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.
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 ?
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.
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
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.