Gentoo Archives: gentoo-user

From: Mick <michaelkintzios@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] [OT]: Optimal formatting a SDcard (64GB) with partions of diffent sizes and filesystems?
Date: Fri, 07 Aug 2015 18:01:59
Message-Id: 201508071901.39072.michaelkintzios@gmail.com
In Reply to: Re: [gentoo-user] [OT]: Optimal formatting a SDcard (64GB) with partions of diffent sizes and filesystems? by Fernando Rodriguez
1 On Friday 07 Aug 2015 04:27:15 Fernando Rodriguez wrote:
2 > On Thursday, August 06, 2015 6:18:59 PM Meino.Cramer@×××.de wrote:
3 > > Hi,
4 > >
5 > > for my tablet PC I used a used 32GB FAT32 formatted SDcard. The
6 > > formatting was already done by the manufacturer.
7 > > Then I screwed it up and had to do the partioning and formatting
8 > > myself again. "No big deal", I thought -- and was wrong.
9 > > Yes, the "thing" I got could be read and written. But it was
10 > > DAMN slow in comparison to the original formatting.
11 > >
12 > > I googled and found a description, which described exactly,
13 > > what I wanted: An optimal formatting for one big FAT32 partion.
14 > > I did it again ;) and: TADA! The speed was back.
15 > > LINK:http://zero1-st.blogspot.de/2012/05/formatting-fat32-volumes-larger-> > than.html
16 > >
17 > > Now I need the something identical but explained in a way
18 > > that it can be successfully applied to any partion layout
19 > > and any SDcard size.
20 > > Currently the new SDcard has 64GB (yes, the tablet eats that size
21 > > well :) and needs at least two partions: One FAT32 and one ext4.
22 > > May be that I need a different layout later.
23 > >
24 > > To what aspect and "logic" do I have to keep my eyes on, when
25 > > it comes partioning/formatting any SDcard size with any partion
26 > > layout and any filesystem?
27 > >
28 > > Thank you very much in advance for any help!
29 > > Best regards,
30 > > Meino
31 >
32 > I wrote a long reply to this and it appears to have been swallowed by
33 > /dev/null.
34 >
35 > SD cards don't have 128K blocks. Except for the very early ones (standard
36 > capacity), they are divided in allocation units (AU) that are 1MB to 4MB
37 > for SDHC and even larger for SDXC. The only way to get that value is by
38 > reading a register in the card (so you can't do it in usermode on linux).
39 >
40 > The AUs are divided into Recording Units (RUs). The size of these can be
41 > deduced from the card speed class (that's the number inside the C on the
42 > label), and the card capacity. For class 2 and 4 if the card is less than
43 > 1GB it's 16KB, otherwise it's 32KB. For class 6 it is 64KB, and for class
44 > 10 it's 512KB.
45 >
46 > After an AU is erased you can write to any of the free RUs in any order in
47 > blocks of 512 bytes sequentially (the block size is configurable by the
48 > driver but 512 is the most common). But if you write to a nonfree RU then
49 > all non- free RU get copied to a new AU. So the performance hit depends on
50 > how many non-free RUs are in the AU when this happens.
51 >
52 > So to get the best performance you need to align the first FAT cluster on
53 > an AU boundary and that the RUs used by the reserved sectors after the FAT
54 > are free. This is not so easy from usermode because you can't get the AU
55 > size and you can't erase the AU to make sure reserved sectors are free.
56 > The Windows 7 and later format utility will do it if you don't partition
57 > the card. The next best thing is to align it to an RU which should be
58 > pretty easy.
59 >
60 > You could guess the AU size by writting blocks of RU size from the start of
61 > the card and timing it. Every time you hit the AU boundary there will be a
62 > longer delay.
63 >
64 > For more details see the SD specification (chapter 4.13).
65 >
66 > https://www.sdcard.org/downloads/pls/
67 >
68 > They also have formatter tools for Windows and OSX. I tried the Windows
69 > version years ago but had problems with it (can't remember what).
70
71 Excellent information Fernando, thank you!
72
73 So there is no tool for me to use to read the AU/RU on the chip?
74
75 --
76 Regards,
77 Mick

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies