Advertisement
karamaz0v

Partition SSD Samsung EVO 840 250 GB for Linux only

Oct 28th, 2013
4,927
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.19 KB | None | 0 0
  1. How to correctly partition and create ext4 fs on this SSD, taking care of the alignment based on Erase Block Size and Page Size.
  2.  
  3. This is intended for a Linux install only on a BIOS system.
  4.  
  5. ----------------------
  6. Partitioning
  7. ----------------------
  8.  
  9. # gdisk /dev/sda
  10.  
  11. ---
  12. GPT fdisk (gdisk) version 0.8.8
  13.  
  14. Partition table scan:
  15. MBR: not present
  16. BSD: not present
  17. APM: not present
  18. GPT: not present
  19.  
  20. Creating new GPT entries.
  21.  
  22. Command (? for help): p
  23. Disk /dev/sda: 488397167 sectors, 232.9 GiB
  24. Logical sector size: 512 bytes
  25. Disk identifier (GUID): 9396D5CC-DBA4-4D65-986F-FF4AA6A7ADA4
  26. Partition table holds up to 128 entries
  27. First usable sector is 34, last usable sector is 488397133
  28. Partitions will be aligned on 2048-sector boundaries
  29. Total free space is 488397100 sectors (232.9 GiB)
  30.  
  31. Number Start (sector) End (sector) Size Code Name
  32. ---
  33.  
  34. Command (? for help): x
  35.  
  36. Expert command (? for help): L
  37. Enter the sector alignment value (1-65536, default = 2048): 3072
  38.  
  39. Expert command (? for help): m
  40.  
  41. -----
  42.  
  43. Command (? for help): n
  44. Partition number (1-128, default 1):
  45. First sector (34-488397133, default = 3072) or {+-}size{KMGTP}:
  46. Last sector (3072-488397133, default = 488397133) or {+-}size{KMGTP}: +3M
  47. Current type is 'Linux filesystem'
  48. Hex code or GUID (L to show codes, Enter = 8300): ef02
  49. Changed type of partition to 'BIOS boot partition'
  50.  
  51. ----------------
  52.  
  53. Command (? for help): n
  54. Partition number (2-128, default 2):
  55. First sector (34-488397133, default = 9216) or {+-}size{KMGTP}:
  56. Last sector (9216-488397133, default = 488397133) or {+-}size{KMGTP}: +45G
  57. Current type is 'Linux filesystem'
  58. Hex code or GUID (L to show codes, Enter = 8300): 8300
  59. Changed type of partition to 'Linux filesystem'
  60.  
  61. ------------------
  62.  
  63. Command (? for help): n
  64. Partition number (3-128, default 3):
  65. First sector (34-488397133, default = 94381056) or {+-}size{KMGTP}:
  66. Last sector (94381056-488397133, default = 488397133) or {+-}size{KMGTP}:
  67. Current type is 'Linux filesystem'
  68. Hex code or GUID (L to show codes, Enter = 8300): 8300
  69. Changed type of partition to 'Linux filesystem'
  70.  
  71. ---------------------
  72.  
  73. Command (? for help): p
  74. Disk /dev/sda: 488397167 sectors, 232.9 GiB
  75. Logical sector size: 512 bytes
  76. Disk identifier (GUID): D0CED8E4-2665-481E-8568-B2C7456A878A
  77. Partition table holds up to 128 entries
  78. First usable sector is 34, last usable sector is 488397133
  79. Partitions will be aligned on 3072-sector boundaries
  80. Total free space is 3038 sectors (1.5 MiB)
  81.  
  82. Number Start (sector) End (sector) Size Code Name
  83. 1 3072 9215 3.0 MiB EF02 BIOS boot partition
  84. 2 9216 94381055 45.0 GiB 8300 Linux filesystem
  85. 3 94381056 488397133 187.9 GiB 8300 Linux filesystem
  86.  
  87.  
  88. --------------
  89.  
  90. Command (? for help): w
  91.  
  92. Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
  93. PARTITIONS!!
  94.  
  95. Do you want to proceed? (Y/N): Y
  96. OK; writing new GUID partition table (GPT) to /dev/sda.
  97. The operation has completed successfully.
  98.  
  99.  
  100. ------------------------------------------------------------------
  101. FS creation
  102. ------------------------------------------------------------------
  103. to format /dev/sda2 and /dev/sda3, will hold / and /home respectively.
  104.  
  105. # mkfs.ext4 -b 4096 -E stride=2,stripe-width=384 /dev/sdXX
  106.  
  107. /////////////////////////////////////////////////////////////////////////////////////////
  108. /////////////////////////////////////////////////////////////////////////////////////////
  109. Details about the previous steps
  110. //////////////
  111.  
  112. ---------------------------------------------------
  113. Information about the Page and Erase Block Size
  114. ----------------
  115.  
  116. according to these posts, the EVO should share the same specs as the 840 non-pro, it's also a TLC.
  117.  
  118. http://askubuntu.com/questions/314262/partition-alignment-confusion
  119. http://www.thessdreview.com/Forums/ssd-beginners-guide-discussion/3630.htm
  120.  
  121. Series 840 250 GB (non-pro):
  122. NAND erase block size: 1536kb
  123. NAND page size: 8kb
  124. So 1536/8 = 192 pages per block.
  125.  
  126. to get the correct alignment, the initial sector of each partition must be a multiple of 1536kb, according to this table
  127.  
  128. Size Sectors
  129. 512 bytes 1
  130. 1 kb 2
  131. 512 kb 1024
  132. 1 MB 2048
  133. 1 GB 2097152
  134.  
  135. the minimum would be 3072 sectors.
  136.  
  137. link for the table and further explanation.
  138. http://siduction.org/index.php?module=news&func=display&sid=78
  139.  
  140. Edit 21/05/14
  141. New source confirming 1536 kiB EBS and 8 kiB page size.
  142.  
  143. https://bbs.archlinux.org/viewtopic.php?pid=1385980#p1385980
  144.  
  145. ---------------------------------------------------
  146. Information about optimizing ext4 filesytem
  147. ----------------
  148. to create the FS, ext4, we will take into account once again the Erase block size,
  149.  
  150. According to the recommendations here
  151. http://thelastmaimou.wordpress.com/2013/05/04/magic-soup-ext4-with-ssd-stripes-and-strides/
  152. https://raid.wiki.kernel.org/index.php/RAID_setup#ext2.2C_ext3.2C_and_ext4
  153.  
  154.  
  155. chunk size = 128kB (set by mdadm cmd, see chunk size advise above)
  156. block size = 4kB (recommended for large files, and most of time)
  157. stride = chunk / block = 128kB / 4k = 32
  158. stripe-width = stride * ( (n disks in raid5) - 1 ) = 32 * ( (3) - 1 ) = 32 * 2 = 64
  159.  
  160. If the chunk-size is 128 kB, it means, that 128 kB of consecutive data will reside on one disk. If we want to build an ext2 filesystem with 4 kB block-size, we realize that there will be 32 filesystem blocks in one array chunk.
  161. stripe-width=64 is calculated by multiplying the stride=32 value with the number of data disks in the array.
  162. A raid5 with n disks has n-1 data disks, one being reserved for parity. (Note: the mke2fs man page incorrectly states n+1; this is a known bug in the man-page docs that is now fixed.) A raid10 (1+0) with n disks is actually a raid 0 of n/2 raid1 subarrays with 2 disks each.
  163.  
  164.  
  165. We'll use the setup of a "raid" with a single drive, making the chunk size equal to the EBS, and using the usual 4KB block size.
  166.  
  167. NAND EBS: 1536 KB
  168. NAND Page size: 8KB
  169.  
  170. chunk size = Page size = 8 KB
  171. block size = 4 KB
  172. stride = Page Size / block size = 2
  173. srtipe-width = EBS / block size = 384
  174.  
  175. all this ends up in
  176.  
  177. mkfs.ext4 -b 4096 -E stride=2,stripe-width=384 /dev/sdXX
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement