Home > partition > fdisk, dd, and the Rapsberry pi

fdisk, dd, and the Rapsberry pi

March 24Hits:1
Advertisement

I was trying to wipe my 4GB SD card which acts as the hard drive for the Raspberry Pi, so I went into Mac OS X Disk Utility* and Erased the entire disk, and specified that the whole disk be one big FAT-32 partition.

The output of fdisk /dev/disk2:

Disk: /dev/disk2    geometry: 975/128/63 [7866368 sectors] Signature: 0xAA55          Starting       Ending  #: id  cyl  hd sec -  cyl  hd sec [     start -       size] ------------------------------------------------------------------------  1: 0B 1023 254  63 - 1023 254  63 [      8192 -    7858176] Win95 FAT-32  2: 00    0   0   0 -    0   0   0 [         0 -          0] unused  3: 00    0   0   0 -    0   0   0 [         0 -          0] unused  4: 00    0   0   0 -    0   0   0 [         0 -          0] unused 

My question is, why does the first partition start at 8192 sectors, and not right after the boot sector?

*Forgive me. My fdisk abilities are not exactly guru-level.

Answers

This is related to the underlying physical sectors of the SD card. In short: The first "block" is optimized to host the File Allocation Table, which describes the structure of a MS hard disk with 1 vfat partition.
This is an assumption that is not true, but a lot of devices, cameras, phones etc just use a vfat storage on a single partition. And the cards are made for this market. The other blocks are optimized for writing big, continuous files (pictures, video, etc).

SD cards use several types of logical blocks, the most important being the "erase block", which is the minimal amount of data that can be erased at once. To write anything on the card, the card controller (inside the SD) has to read a whole erase block first, then erase it, then write it with the updated content.
I have an old 4G card with a 1M block, most recent cards have a 4M block.

That's 8192 512-bytes sectors.

So you have to align your partition so that writing a file on the card doesn't end up in erasing 1 extra block. Otherwise you end up with a card that is slower to write to a noticiable point when eg you write some small files.
More info on lwn.net: Optimizing Linux with cheap flash drives

I don't know about Mac OS X Disk Utility. Maybe It's a safe default, or it performs some magic. see flashbench for more info on your card.

Related Articles

  • fdisk, dd, and the Rapsberry piMarch 24

    I was trying to wipe my 4GB SD card which acts as the hard drive for the Raspberry Pi, so I went into Mac OS X Disk Utility* and Erased the entire disk, and specified that the whole disk be one big FAT-32 partition. The output of fdisk /dev/disk2: Di

  • "fdisk -l" like list of partitions and their types for LVM logical volumes?June 20

    You know how "fdisk -l" lists drive partition tables and shows the partition id/types for each partition? Is there a similar way to get the partition id for LVM logical volumes? EDIT: I'm aware of "lvs", which is mostly what I'm lookin

  • Can you change the partition type on a linux server without starting up fdisk?July 27

    I'm looking for a way to change a partition type on a linux system without starting fdisk. (In this particular case from "linux" to "softwareRAID") The ultimate goal here is a script that is going to take /dev/sda and automatically cre

  • How to recover a partition accidently deleted with fdisk (Linux)?October 19

    I am using FC6 in VMware, I accidently deleted my partition by using fdisk, it told me that after the restart, the partition will be deleted. Now I lost all my important data in that drive. What are the ways to recover this partition? UPDATE I instal

  • Hard drive utilities: FDISK, Format, etcOctober 23

    I need to rebuild my dev box later tonight. What utility do you use for FDISK, and Formatting your drives. I usually do this stuff in Windows but will need to start with bare metal. Last time I did this stuff was with DOS - ouch, it's been awhile. Fr

  • On Ubuntu / Linux, after running ntfsresize, must you run fdisk? Instead, can you run GParted to resize the partition?November 1

    GParted cannot shrink the partition since it says there are 5 bad sectors that are hardware related. (Scan disk on Windows XP can't fix them). So, after booting up the GParted disc, I used the Terminal to do a ntfsresize --bad-sectors --size 63G /dev

  • After ntfsresize (ntfs resize), what is the exact line to type in for fdisk?

    After ntfsresize (ntfs resize), what is the exact line to type in for fdisk?November 21

    I was told that after ntfsresize (ntfs resize), the fdisk command needs to be run... But how can it be run? What is the exact line? In a book Knoppix Hacks, it seems to suggest needing some parameter except it is not using any in its example. Does an

  • fdisk -l shows a partition is not in /dev directoryMarch 17

    I am having troubles on mounting my NTFS hard drive on Linux. I am running Ophcrack live CD. fdisk shows me the hard drive I have installed on my computer. fdisk -l Disk /dev/hdc: 30.0 GB, 30005821440 bytes 255 heads, 63 sectors/track, 3648 cylinders

  • fdisk (Linux) partitioning RAID 0April 28

    I'm trying to create partitions for a Slackware installation on my computer (beside Windows 7) just to have a nice distribution running mostly for school but when I run fdisk and print the partition table I get the following message: Partition x does

  • What is the "the dos compatibility flag" in fdisk?July 16

    I fired up fdisk and got this warning: WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). I didn't even know that my previous Linux installs wh

  • fdisk unable to openOctober 19

    I am having problems using fdisk to clear the partition table of my sd card. The sd card is identified in the /dev folder when inserted into the sd card reader, but when the following command in run: fdisk /dev/sde the response in the terminal is: un

  • Making fdisk see software RAID 0December 26

    I am following http://grub.enbug.org/Grub2LiveCdInstallGuide and I am using software RAID 0. I am using Ubuntu 10.10 LiveCD and is trying to restore grub2 after installing Windows 7 in another partition. Here is the console's outputs: [email protected]:~

  • Which numbers does fdisk show?February 12

    I have run sudo fdisk -l and have got the following information: Disk /dev/sda: 120.0 GB, 120034123776 bytes 255 heads, 63 sectors/track, 14593 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes This utility shows the whole size of the hard d

  • Understanding fdisk -lApril 9

    When i entered #fdisk -l in unbuntu 9.04 following is the result Disk /dev/sda: 160.0 GB, 160041885696 bytes 255 heads, 63 sectors/track, 19457 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0xe9ffe9ff Device Boot Start E

  • fdisk - partition in single lineApril 11

    Can you create a partition in a usb disk using fdisk command in a single line. fdisk command is interactive in nature, But I want to automate partition creation in a single line using fdisk command. --------------Solutions------------- Trying to auto

  • what can be wrong with my fdisk -l output?

    what can be wrong with my fdisk -l output?June 8

    I have reinstalled Ubuntu 5 times already and I can't find what is wrong I messed with /etc/fstab and seems I don't have swap space Can some one help me and tell if this is a healthy fdisk -l, and if not what I should do? Disk /dev/sda: 20.4 GB, 2041

  • Difference between File system created by fdisk and file system created by mkfs - linux

    Difference between File system created by fdisk and file system created by mkfs - linuxAugust 1

    I'm a little bit confused with partitioning the filesystem in Linux. Please tell me the difference between creating the file system with fdisk and mkfs (when formatting the disk). I can't clearly tell my problem, so please look at this picture: -----

  • With Ubuntu's fdisk, what does "omitting empty partition" mean?August 10

    I currently have a 250 GB hard disk dual booting Windows XP and Ubuntu 11.04. The main partitions are as followed: Windows XP main partition: 160 GB An NTFS partition which only contains media files: 40 GB Linux partition: 45 GB The rest of the space

  • Why do we need to specify partition type in fdisk and later again in mkfs?August 10

    I'm a little confused about fdisk and mkfs. So - here is typical USB flash drive partitioning and formatting: umount /dev/sdb fdisk fdisk /dev/sdb Command (m for help): d Selected partition 1 Command (m for help): n Command action e extended p primar

  • Is the fdisk partition type important when using lvmAugust 30

    I have inherited a few LVM volumes and I noticed that fdisk reports the disks that make up the volume group as partition type 83 (Linux) and not 8e (Linux LVM). Is this a problem and how important are the fdisk partion types? Do they affect anything

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.609 s.