1

I am trying hard to format a 1GB USB stick so that I can use it to install a new linux OS. Because the Disk utility has failed me when creating the file system. I tried to do it manually using fdisk by going through the following steps to create the master boot record and a 1GB partition:

# fdisk /dev/sdc

Command (m for help): p
Disk /dev/sdc: 994.5 MiB, 1042808832 bytes, 509184 sectors
Units: sectors of 1 * 2048 = 2048 bytes
Sector size (logical/physical): 2048 bytes / 2048 bytes
I/O size (minimum/optimal): 2048 bytes / 2048 bytes
Disklabel type: dos
Disk identifier: 0x967a68db

Device    Boot Start       End  Blocks  Id System
/dev/sdc1 *        1    509183 1018366   b W95 FAT32

Command (m for help): o

Created a new DOS disklabel with disk identifier 0x727b4976.

Command (m for help): n

Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (512-509183, default 512): 
Last sector, +sectors or +size{K,M,G,T,P} (512-509183, default 509183): 

Created a new partition 1 of type 'Linux' and of size 993.5 MiB.

Command (m for help): v
Partition 1: cylinder 253 greater than maximum 252
Partition 1: previous sectors 509183 disagrees with total 507835
Remaining 511 unallocated 2048-byte sectors.

Command (m for help): w

The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

Then I tried to format it to FAT32 file system with 512 bytes sector size, but it says the minimum allowed is 2048 bytes.

# mkfs.fat -v -F 32 -S 512 /dev/sdc1
mkfs.fat 3.0.26 (2014-03-07)
Warning: sector size was set to 2048 (minimal for this device)
WARNING: Not enough clusters for a 32 bit FAT!
/dev/sdc1 has 33 heads and 61 sectors per track,
hidden sectors 0x0800;
logical sector size is 2048,
using 0xf8 media descriptor, with 508672 sectors;
drive number 0x80;
filesystem has 2 32-bit FATs and 8 sectors per cluster.
FAT size is 125 sectors, and provides 63548 clusters.
There are 32 reserved sectors.
Volume ID is 1ab3abc1, no volume label.

I need 512 bytes sector as syslinux does not support larger sector size.

  • I says "Created a new partition 1 of type 'Linux' and of size 993.5 MiB.". After creating the new partition, can you try to change partition type by pressing 't'? – alpert Aug 14 '14 at 10:25
  • @alpertek, I repeated the whole procedure again and changed the partition type to Win95 FAT 32, but it still give me the same warnings. – Question Overflow Aug 14 '14 at 10:36
  • Can you try to add -s2 parameter? – alpert Aug 14 '14 at 11:05
  • @alpertek, that would help clear the not enough clusters warning, but not help in reducing the sector size. – Question Overflow Aug 14 '14 at 11:34
  • I think, as it says "minimal for this device", that is a restriction about your device/usb stick. There is a "ioctl(dev, BLKSSZGET, &min_sector_size)" call in source code and if you specify a sector size and that is bigger than min_sector_size you get that warning. – alpert Aug 14 '14 at 11:55
1

OK, so in Computer Science, I'm not overly fond of saying "you can't get there from here", but in this case, you're trying to fit a square peg into a round hole.

The Sector size is usually set by the DEVICE. The 2048B sector size reported is normal for a CD/DVD drive, whereas 512B (or 520B -- which is why I said USUALLY -- some hard drives can actually switch from 512 to 520 and back).

When you ran fdisk, it clearly showed that the media sector size is 2048B. You can't easily change that, and in all likelihood, you can't change that period. You could try contacting the manufacturer of the USB drive to see if there is a tool available to reset the sector size on that device... or you could drive to the store (Walmart? Target? Staples? you name it!) and spend the $5 to $10 to buy a new USB stick.

| improve this answer | |
2

For:

WARNING: Not enough clusters for a 32 bit FAT!

you can use -s2 parameter at mkfs.fat command.

On the other hand

if (sector_size_set)
{
  if (ioctl(dev, BLKSSZGET, &min_sector_size) >= 0)
      if (sector_size < min_sector_size)
        {
      sector_size = min_sector_size;
          fprintf(stderr, "Warning: sector size was set to %d (minimal for this device)\n", sector_size);
        }
}

is the code snippet that gives first warning. As seen if sector size is set, it gets minimum logical sector size of device and if given sector size lower than minimum sector size, the warning is given and minimum sector size assigned as sector size.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.