Raspberry Pi vadná SD karta vs. OLIMEX a jiné jednodesky

Václav Ovsík vaclav.ovsik na gmail.com
Pátek Červen 3 21:25:22 CEST 2016


On Fri, Jun 03, 2016 at 04:26:26PM +0200, Michal Grunt wrote:
> Můžete prosím napsat jak by karta měla být správně rozdělena? Děkuji.

Popravde si nejsem moc jist :). Co je pitome je, ze rada techdle flash
veci ma na zacatku erase bloku s mnohem mensi velikosti, protoze tam
ocekava FAT tabulky a adresare VFAT filesystemu. Dale uz jsou bloky
s vetsi velikosti. RPi ma na zacatku FAT, kde se nezapisuje, ale jenom
bootuje. Druhy oddil je az ext4 a ten je tedy az dal a tedy se nevytezi
ty male erase bloky na zacatku. Ale mozna uz to dnes ani neni pravda.
Jinak https://en.wikipedia.org/wiki/Solid-state_drive#Page_alignment
pisou:

  While not a file system feature, operating systems must also align
  partitions correctly to avoid excessive read-modify-write cycles.
  A typical practice for personal computers is to have each partition
  aligned to start at a 1 MiB (= 1,048,576 bytes) mark, which covers all
  common SSD page and block size scenarios, as it is divisible by 1 MiB,
  512 KiB, 128 KiB, 4 KiB, and 512 bytes. Modern operating system
  installation software and disk tools handle this automatically.

Takze zarovnani oddilu holt na 1MiB a melo by to byt ok.

Ja uz si presne nepamatuju jak jsem ty FS vytvarel, ale ted jsem
nabootoval svoje RPi a tam mam:

  root na rpi:~# fdisk -l
  
  Disk /dev/mmcblk0: 7.5 GiB, 8068792320 bytes, 15759360 sectors
  Units: sectors of 1 * 512 = 512 bytes
  Sector size (logical/physical): 512 bytes / 512 bytes
  I/O size (minimum/optimal): 512 bytes / 512 bytes
  Disklabel type: dos
  Disk identifier: 0xb0a065bc
  
  Device         Boot  Start      End  Sectors  Size Id Type
  /dev/mmcblk0p1        8192   262143   253952  124M  c W95 FAT32 (LBA)
  /dev/mmcblk0p2      262144 15759359 15497216  7.4G 83 Linux

Ta FAT neni kriticka, tak neresim...

  root na rpi:~# dumpe2fs -h /dev/mmcblk0p2 
  dumpe2fs 1.42.12 (29-Aug-2014)
  Filesystem volume name:   debian
  Last mounted on:          /
  Filesystem UUID:          bea9885f-cef9-4779-b318-50a979e9aafe
  Filesystem magic number:  0xEF53
  Filesystem revision #:    1 (dynamic)
  Filesystem features:      ext_attr resize_inode dir_index filetype extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
  Filesystem flags:         signed_directory_hash 
  Default mount options:    user_xattr acl
  Filesystem state:         not clean
  Errors behavior:          Continue
  Filesystem OS type:       Linux
  Inode count:              484800
  Block count:              1937152
  Reserved block count:     96857
  Free blocks:              798713
  Free inodes:              332214
  First block:              0
  Block size:               4096
  Fragment size:            4096
  Reserved GDT blocks:      472
  Blocks per group:         32768
  Fragments per group:      32768
  Inodes per group:         8080
  Inode blocks per group:   505
  RAID stride:              4
  RAID stripe width:        256
  Flex block group size:    16
  Filesystem created:       Sun Mar 22 21:24:16 2015
  Last mount time:          Thu Jan  1 01:00:02 1970
  Last write time:          Thu Jan  1 01:00:05 1970
  Mount count:              68
  Maximum mount count:      -1
  Last checked:             Mon Feb  8 22:17:32 2016
  Check interval:           0 (<none>)
  Lifetime writes:          125 GB
  Reserved blocks uid:      0 (user root)
  Reserved blocks gid:      0 (group root)
  First inode:              11
  Inode size:	          256
  Required extra isize:     28
  Desired extra isize:      28
  Default directory hash:   half_md4
  Directory Hash Seed:      56f1a9c3-8a74-435c-bbc8-d536488c8d41


Jak vidno - je vynechany journal - tim se usetri polovina zapisu.
(Nepise se nejprve do journalu.)
https://www.raspberrypi.org/forums/viewtopic.php?f=9&t=850
  - Format partitions with journalling disabled
  sudo mkfs.ext4 -O ^has_journal -L PiBoot /dev/sdx1

...
  Add the noatime (no access time), no diratime (same for directories instead
  of files) and data=writeback options after the defaults parameters for each
  drive, except swap. Modified line should read something like:

  /dev/sda2 / ext4 defaults,data=writeback,noatime,nodiratime 0 0


Ja mam napriklad

  root na rpi:~# cat /etc/fstab 
  /dev/mmcblk0p2 / ext4 noatime,errors=remount-ro 0 1
  /dev/mmcblk0p1 /boot/firmware vfat defaults 0 2 

apod

Mam odstraneny rsyslog, takze do /var/log pisou uz jenom par aplikaci

  root na rpi:~# ll /var/log/ -rt |tail -4
  -rw-r--r-- 1 root root     366 May 26 23:18 slim.log
  -rw-rw-r-- 1 root utmp   66048 Jun  3 21:05 wtmp
  -rw-rw-r-- 1 root utmp  292584 Jun  3 21:05 lastlog
  -rw-r--r-- 1 root root   10633 Jun  3 21:14 Xorg.0.log

Xserver napr.
Na logy koukam jenom pres journalctl (ten ma data v /run/...).

-- 
Zito


Další informace o konferenci Hw-list