Raspberry Colocation bei EDIS/Partitionen und Images

Aus LOMSO
Zur Navigation springen Zur Suche springen
Du bist hier : Warning : Could not determine path to wiki home for Raspberry Colocation bei EDIS/Partitionen und Images !
Please check your category settings !



Partitionen und Images

Prüfen einer gelieferten Karte

root@acca:/tmp# fdisk -l /dev/sdx

Disk /dev/sdx: 64.4 GB, 64440238080 bytes
255 Köpfe, 63 Sektoren/Spur, 7834 Zylinder, zusammen 125859840 Sektoren
Einheiten = Sektoren von 1 × 512 = 512 Bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Festplattenidentifikation: 0x00000000

   Gerät  boot.     Anfang        Ende     Blöcke   Id  System
/dev/sdx1            8192   125859839    62925824    7  HPFS/NTFS/exFAT

Leeren der SD Karte

Dies machen wir um

  • vorher evtl noch vorhandene alte Daten sicher zu löschen
  • um bei zukünftigen komprimierten Images Speicherplatz zu sparen

Achtung: Je nach installierten Laufwerken kann die Bezeichung /dev/sdx abweichen. Die folgenden Schritte können Daten des Systems zerstören. Im Zweifel vor jedem mit root Rechten schreibenden Kommando ein "dmesg |tail" oder "dmesg|grep sd" ausführen und kontrollieren, ob man auf dem richtigen Laufwerk arbeitet. Falls dmesg Zweifel lässt, das Ergebnis mit "fdisk -l /dev/sdX" (mit X für a, b, c usw) kontrollieren.

root@acca:/tmp# dd if=/dev/zero of=/dev/sdx bs=4M &

Das dauert jetzt etwas, man kann schauen wie weit es grade ist mit:

root@acca:/tmp# kill -USR1 %1
root@acca:/tmp# 309+0 Datensätze ein
309+0 Datensätze aus
1296039936 Bytes (1,3 GB) kopiert, 65,6308 s, 19,7 MB/s

Auspacken und Prüfen des Image Downloads

root@acca:/tmp# tar xfz 2013-10-13-wheezy-minibian.tar.gz
root@acca:/tmp# ls -l 2013-10-13-wheezy-minibian.img
-rw-r--r-- 1 root root 930086912 Okt 13 14:22 2013-10-13-wheezy-minibian.img

Nachschauen, welche Partitionen das Original Image verwendet

root@acca:/tmp# fdisk -l 2013-10-13-wheezy-minibian.img

Platte 2013-10-13-wheezy-minibian.img: 930 MByte, 930086912 Byte
255 Köpfe, 63 Sektoren/Spur, 113 Zylinder, zusammen 1816576 Sektoren
Einheiten = Sektoren von 1 × 512 = 512 Bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Festplattenidentifikation: 0x00088739

                         Gerät  boot.     Anfang        Ende     Blöcke   Id  System
2013-10-13-wheezy-minibian.img1   *        2048      155647       76800    b  W95 FAT32
2013-10-13-wheezy-minibian.img2          155648     1816575      830464   83  Linux

Oder mit parted (mit Einheit Sektoren, damit man später präzise restaurieren, Partitionen ändern usw kann):

root@acca:/tmp# parted 2013-10-13-wheezy-minibian.img unit s print
Modell:  (file)
Festplatte  /tmp/2013-10-13-wheezy-minibian.img:  1816576s
Sektorgröße (logisch/physisch): 512B/512B
Partitionstabelle: msdos

Nummer  Anfang   Ende      Größe     Typ      Dateisystem  Flags
 1      2048s    155647s   153600s   primary  fat32        boot
 2      155648s  1816575s  1660928s  primary  ext4

Kopieren des Images auf die Karte

root@acca:/tmp# dd if=2013-10-13-wheezy-minibian.img of=/dev/sdx bs=4M &

Achtung: Hiermit bekommt die SD Karte für den Kernel unerwartet eine neue Partitionierung, d.h. man sollte die Karte kurz Aus/Einstecken, damit der Kernel wieder ein konsistentes Bild hat. Achtung, dabei könnte sich die device Nummer ändern (z.B. aus /dev/sdx wird /dev/sdx).

Liste der Minibian Pakete

Eine um uninteressante Kandidaten gekürzte Liste aller auf der Distri vorhandenen Pakete bekommt man mit:

root@acca:/tmp# dpkg -l --admindir=/mnt/var/lib/dpkg |egrep -v '^ii  lib\w+' |egrep -v '^ii  python.?-\w+'
Gewünscht=Unbekannt/Installieren/R=Entfernen/P=Vollständig Löschen/Halten
| Status=Nicht/Installiert/Config/U=Entpackt/halb konFiguriert/
         Halb installiert/Trigger erWartet/Trigger anhängig
|/ Fehler?=(kein)/R=Neuinstallation notwendig (Status, Fehler: GROSS=schlecht)
||/ Name                            Version                       Architektur  Beschreibung
+++-===============================-=============================-============-==========================================================================
ii  adduser                         3.113+nmu3                    all          add and remove users and groups
ii  apt                             0.9.7.8+rpi1                  armhf        commandline package manager
ii  apt-listchanges                 2.85.11                       all          package change history notification tool
ii  apt-utils                       0.9.7.8+rpi1                  armhf        package managment related utility programs
ii  aptitude                        0.6.8.2-1                     armhf        terminal-based package manager
ii  aptitude-common                 0.6.8.2-1                     all          architecture indepedent files for the aptitude package manager
ii  at                              3.1.13-2                      armhf        Delayed job execution and batch processing
ii  base-files                      7.1wheezy1+rpi1               armhf        Debian base system miscellaneous files
ii  base-passwd                     3.5.26                        armhf        Debian base system master password and group files
ii  bash                            4.2+dfsg-0.1                  armhf        GNU Bourne Again SHell
ii  bash-completion                 1:2.0-1                       all          programmable completion for the bash shell
ii  bc                              1.06.95-2                     armhf        The GNU bc arbitrary precision calculator language
ii  bind9-host                      1:9.8.4.dfsg.P1-6+nmu2+deb7u1 armhf        Version of 'host' bundled with BIND 9.X
ii  bsd-mailx                       8.1.2-0.20111106cvs-1         armhf        simple mail user agent
ii  bsdmainutils                    9.0.3                         armhf        collection of more utilities from FreeBSD
ii  bsdutils                        1:2.20.1-5.3                  armhf        Basic utilities from 4.4BSD-Lite
ii  bzip2                           1.0.6-4                       armhf        high-quality block-sorting file compressor - utilities
ii  ca-certificates                 20130119                      all          Common CA certificates
ii  console-setup                   1.88                          all          console font and keymap setup program
ii  console-setup-linux             1.88                          all          Linux specific part of console-setup
ii  coreutils                       8.13-3.5                      armhf        GNU core utilities
ii  cpio                            2.11+dfsg-0.1                 armhf        GNU cpio -- a program to manage archives of files
ii  cron                            3.0pl1-124                    armhf        process scheduling daemon
ii  dash                            0.5.7-3                       armhf        POSIX-compliant shell
ii  db5.1-util                      5.1.29-5                      armhf        Berkeley v5.1 Database Utilities
ii  dc                              1.06.95-2                     armhf        The GNU dc arbitrary precision reverse-polish calculator
ii  debconf                         1.5.49                        all          Debian configuration management system
ii  debconf-i18n                    1.5.49                        all          full internationalization support for debconf
ii  debian-faq                      5.0.1                         all          Debian FAQ
ii  debianutils                     4.3.2                         armhf        Miscellaneous utilities specific to Debian
ii  debsig-verify                   0.8                           armhf        Debian Package Signature Verification Tool
ii  dictionaries-common             1.12.11                       all          Common utilities for spelling dictionary tools
ii  diffutils                       1:3.2-6                       armhf        File comparison utilities
ii  discover                        2.1.2-5.2                     armhf        hardware identification system
ii  discover-data                   2.2010.10.18                  all          Data lists for Discover hardware detection system
ii  dmsetup                         2:1.02.74-7+rpi1              armhf        Linux Kernel Device Mapper userspace library
ii  dnsutils                        1:9.8.4.dfsg.P1-6+nmu2+deb7u1 armhf        Clients provided with BIND
ii  doc-debian                      6.1                           all          Debian Project documentation and other documents
ii  dosfstools                      3.0.13-1                      armhf        utilities for making and checking MS-DOS FAT filesystems
ii  dpkg                            1.16.10                       armhf        Debian package management system
ii  e2fslibs:armhf                  1.42.5-1.1                    armhf        ext2/ext3/ext4 file system libraries
ii  e2fsprogs                       1.42.5-1.1                    armhf        ext2/ext3/ext4 file system utilities
ii  elvis-tiny                      1.4-23                        armhf        Tiny vi compatible editor for the base system
ii  exim4                           4.80-7                        all          metapackage to ease Exim MTA (v4) installation
ii  exim4-base                      4.80-7                        armhf        support files for all Exim MTA (v4) packages
ii  exim4-config                    4.80-7                        all          configuration for the Exim MTA (v4)
ii  exim4-daemon-light              4.80-7                        armhf        lightweight Exim MTA (v4) daemon
ii  fake-hwclock                    0.5                           all          Save/restore system clock on machines without working RTC hardware
ii  file                            5.11-2                        armhf        Determines file type using "magic" numbers
ii  findutils                       4.4.2-4                       armhf        utilities for finding files--find, xargs
ii  ftp                             0.17-27                       armhf        classical file transfer client
ii  gcc-4.5-base:armhf              4.5.3-12+rpi1                 armhf        The GNU Compiler Collection (base package)
ii  gcc-4.6-base:armhf              4.6.3-14+rpi1                 armhf        GCC, the GNU Compiler Collection (base package)
ii  gcc-4.7-base:armhf              4.7.2-5+rpi1                  armhf        GCC, the GNU Compiler Collection (base package)
ii  geoip-database                  20130213-1                    all          IP lookup command line tools that use the GeoIP library (country database)
ii  gettext-base                    0.18.1.1-9                    armhf        GNU Internationalization utilities for the base system
ii  gnupg                           1.4.12-7+deb7u2               armhf        GNU privacy guard - a free PGP replacement
ii  gpgv                            1.4.12-7+deb7u2               armhf        GNU privacy guard - signature verification tool
ii  grep                            2.12-2                        armhf        GNU grep, egrep and fgrep
ii  groff-base                      1.21-9                        armhf        GNU troff text-formatting system (base system components)
ii  gzip                            1.5-1.1                       armhf        GNU compression utilities
ii  hostname                        3.11                          armhf        utility to set/show the host name or domain name
ii  iamerican                       3.3.02-6                      all          American English dictionary for ispell (standard version)
ii  ibritish                        3.3.02-6                      all          British English dictionary for ispell (standard version)
ii  icelib                          1.0.15636                     armhf        ICELib offers enhanced capabilities for apps and games.
ii  icelib-dev                      1.0.15267                     armhf        ICELib-dev offers gives the developers.
ii  ienglish-common                 3.3.02-6                      all          Common files for British and American ispell dictionaries
ii  ifupdown                        0.7.8                         armhf        high level tools to configure network interfaces
ii  info                            4.13a.dfsg.1-10               armhf        Standalone GNU Info documentation browser
ii  initramfs-tools                 0.109.1                       all          generic modular initramfs generator
ii  initscripts                     2.88dsf-41                    armhf        scripts for initializing and shutting down the system
ii  insserv                         1.14.0-5                      armhf        boot sequence organizer using LSB init.d script dependency information
ii  install-info                    4.13a.dfsg.1-10               armhf        Manage installed documentation in info format
ii  installation-report             2.49                          all          system installation report
ii  iproute                         20120521-3                    armhf        networking and traffic control tools
ii  iptables                        1.4.14-3.1                    armhf        administration tools for packet filtering and NAT
ii  iputils-ping                    3:20101006-1                  armhf        Tools to test the reachability of network hosts
ii  isc-dhcp-client                 4.2.2.dfsg.1-5+deb70u6        armhf        ISC DHCP client
ii  isc-dhcp-common                 4.2.2.dfsg.1-5+deb70u6        armhf        common files used by all the isc-dhcp* packages
ii  iso-codes                       3.41-1                        all          ISO language, territory, currency, script codes and their translations
ii  ispell                          3.3.02-6                      armhf        International Ispell (an interactive spelling corrector)
ii  kbd                             1.15.3-9                      armhf        Linux console font and keytable utilities
ii  keyboard-configuration          1.88                          all          system-wide keyboard preferences
ii  klibc-utils                     2.0.1-3.1+rpi1                armhf        small utilities built with klibc for early boot
ii  kmod                            9-3                           armhf        tools for managing Linux kernel modules
ii  krb5-locales                    1.10.1+dfsg-5+deb7u1          all          Internationalization support for MIT Kerberos
ii  less                            444-4                         armhf        pager program similar to more
ii  linux-libc-dev:armhf            3.2.46-1+rpi1                 armhf        Linux support headers for userspace development
ii  locales                         2.13-38+rpi2                  all          Embedded GNU C Library: National Language (locale) data [support]
ii  login                           1:4.1.5.1-1                   armhf        system login tools
ii  logrotate                       3.8.1-4                       armhf        Log rotation utility
ii  lsb-base                        4.1+Debian8+rpi1              all          Linux Standard Base 4.1 init script functionality
ii  lsb-release                     4.1+Debian8+rpi1              all          Linux Standard Base version reporting utility
ii  lsof                            4.86+dfsg-1                   armhf        Utility to list open files
ii  m4                              1.4.16-3                      armhf        a macro processing language
ii  make                            3.81-8.2                      armhf        An utility for Directing compilation.
ii  makedev                         2.3.1-92                      all          creates device files in /dev
ii  man-db                          2.6.2-1                       armhf        on-line manual pager
ii  manpages                        3.44-1                        all          Manual pages about using a GNU/Linux system
ii  mawk                            1.3.3-17                      armhf        a pattern scanning and text processing language
ii  mime-support                    3.52-1                        all          MIME files 'mime.types' & 'mailcap', and support programs
ii  mlocate                         0.23.1-1                      armhf        quickly find files on the filesystem based on their name
ii  mount                           2.20.1-5.3                    armhf        Tools for mounting and manipulating filesystems
ii  mountall                        2.46                          armhf        filesystem mounting tool
ii  multiarch-support               2.13-38+rpi2                  armhf        Transitional package to ensure multiarch compatibility
ii  mutt                            1.5.21-6.2                    armhf        text-based mailreader supporting MIME, GPG, PGP and threading
ii  nano                            2.2.6-1                       armhf        small, friendly text editor inspired by Pico
ii  ncurses-base                    5.9-10                        all          basic terminal type definitions
ii  ncurses-bin                     5.9-10                        armhf        terminal-related programs and man pages
ii  ncurses-term                    5.9-10                        all          additional terminal type definitions
ii  net-tools                       1.60-24.2                     armhf        The NET-3 networking toolkit
ii  netbase                         5.0                           all          Basic TCP/IP networking system
ii  netcat-openbsd                  1.105-7                       armhf        TCP/IP swiss army knife
ii  netcat-traditional              1.10-40                       armhf        TCP/IP swiss army knife
ii  nfs-common                      1:1.2.6-4                     armhf        NFS support files common to client and server
ii  ntp                             1:4.2.6.p5+dfsg-2             armhf        Network Time Protocol daemon and utility programs
ii  openssh-blacklist               0.4.1+nmu1                    all          list of default blacklisted OpenSSH RSA and DSA keys
ii  openssh-blacklist-extra         0.4.1+nmu1                    all          list of non-default blacklisted OpenSSH RSA and DSA keys
ii  openssh-client                  1:6.0p1-4                     armhf        secure shell (SSH) client, for secure access to remote machines
ii  openssh-server                  1:6.0p1-4                     armhf        secure shell (SSH) server, for secure access from remote machines
ii  openssl                         1.0.1e-2+rpi1                 armhf        Secure Socket Layer (SSL) binary and related cryptographic tools
ii  passwd                          1:4.1.5.1-1                   armhf        change and administer password and group data
ii  patch                           2.6.1-3                       armhf        Apply a diff file to an original
ii  pciutils                        1:3.1.9-6                     armhf        Linux PCI Utilities
ii  perl                            5.14.2-21+rpi2                armhf        Larry Wall's Practical Extraction and Report Language
ii  perl-base                       5.14.2-21+rpi2                armhf        minimal Perl system
ii  perl-modules                    5.14.2-21+rpi2                all          Core Perl modules
ii  plymouth                        0.8.5.1-5                     armhf        Graphical Boot Animation and Logger
ii  procmail                        3.22-20                       armhf        Versatile e-mail processor
ii  procps                          1:3.3.3-3                     armhf        /proc file system utilities
ii  psmisc                          22.19-1+deb7u1                armhf        utilities that use the proc file system
ii  python                          2.7.3-4                       all          interactive high-level object-oriented language (default version)
ii  python2.6                       2.6.8-1.1                     armhf        Interactive high-level object-oriented language (version 2.6)
ii  python2.6-minimal               2.6.8-1.1                     armhf        Minimal subset of the Python language (version 2.6)
ii  python2.7                       2.7.3-6                       armhf        Interactive high-level object-oriented language (version 2.7)
ii  python2.7-minimal               2.7.3-6                       armhf        Minimal subset of the Python language (version 2.7)
ii  raspberrypi-bootloader          1.20130902-1                  armhf        Raspberry Pi bootloader
ii  raspbian-archive-keyring        20120528.2                    all          GnuPG archive keys of the raspbian archive
ii  raspi-copies-and-fills          0.4-1                         armhf        Optimised memcpy/memset implementation for ARM11 used in Raspberry Pi
ii  readline-common                 6.2+dfsg-0.1                  all          GNU readline and history libraries, common files
ii  reportbug                       6.4.4                         all          reports bugs in the Debian distribution
ii  rpcbind                         0.2.0-8                       armhf        converts RPC program numbers into universal addresses
ii  rsyslog                         5.8.11-3                      armhf        reliable system and kernel logging daemon
ii  sed                             4.2.1-10                      armhf        The GNU sed stream editor
ii  sensible-utils                  0.0.7                         all          Utilities for sensible alternative selection
ii  sgml-base                       1.26+nmu4                     all          SGML infrastructure and SGML catalog file support
ii  sysv-rc                         2.88dsf-41                    all          System-V-like runlevel change mechanism
ii  sysvinit                        2.88dsf-41                    armhf        System-V-like init utilities
ii  sysvinit-utils                  2.88dsf-41                    armhf        System-V-like utilities
ii  tar                             1.26+dfsg-0.1                 armhf        GNU version of the tar archiving utility
ii  task-english                    3.14.1                        all          General English environment
ii  task-ssh-server                 3.14.1                        all          SSH server
ii  tasksel                         3.14.1                        all          Tool for selecting tasks for installation on Debian systems
ii  tasksel-data                    3.14.1                        all          Official tasks used for installation of Debian systems
ii  tcpd                            7.6.q-24                      armhf        Wietse Venema's TCP wrapper utilities
ii  telnet                          0.17-36                       armhf        The telnet client
ii  texinfo                         4.13a.dfsg.1-10               armhf        Documentation system for on-line information and printed output
ii  time                            1.7-24                        armhf        GNU time program for measuring CPU resource usage
ii  traceroute                      1:2.0.18-3                    armhf        Traces the route taken by packets over an IPv4/IPv6 network
ii  tzdata                          2013c-0wheezy1                all          time zone and daylight-saving time data
ii  ucf                             3.0025+nmu3                   all          Update Configuration File: preserve user changes to config files.
ii  udev                            175-7.2                       armhf        /dev/ and hotplug management daemon
ii  usbutils                        1:005-3                       armhf        Linux USB utilities
ii  util-linux                      2.20.1-5.3                    armhf        Miscellaneous system utilities
ii  util-linux-locales              2.20.1-5.3                    all          Locales files for util-linux
ii  vacation                        3.3.0-0.4                     armhf        email autoresponder
ii  vim-common                      2:7.3.547-7                   armhf        Vi IMproved - Common files
ii  vim-tiny                        2:7.3.547-7                   armhf        Vi IMproved - enhanced vi editor - compact version
ii  w3m                             0.5.3-8                       armhf        WWW browsable pager with excellent tables/frames support
ii  wamerican                       7.1-1                         all          American English dictionary words for /usr/share/dict
ii  wget                            1.13.4-3                      armhf        retrieves files from the web
ii  whiptail                        0.52.14-11.1                  armhf        Displays user-friendly dialog boxes from shell scripts
ii  whois                           5.0.23                        armhf        intelligent WHOIS client
ii  xauth                           1:1.0.7-1                     armhf        X authentication utility
ii  xkb-data                        2.5.1-3                       all          X Keyboard Extension (XKB) configuration data
ii  xml-core                        0.13+nmu2                     all          XML infrastructure and XML catalog file support
ii  xz-utils                        5.1.1alpha+20120614-2         armhf        XZ-format compression utilities
ii  zlib1g:armhf                    1:1.2.7.dfsg-13               armhf        compression library - runtime
ii  zlib1g-dev:armhf                1:1.2.7.dfsg-13               armhf        compression library - development

Vergrössern der Root Partition

Im Originalzustand sind auf der Root Partition noch ca. 220MB frei. Das ist etwas knapp für den Fall, dass wir viel Software installieren und/oder wir etwas vergessen auf andere Partitionen auszulagern, was dann schnell anwächst und das System möglicherweise blockiert.

Hier wählen wir eine Größe von 4GB, repartitionieren und lassen das Filesystem anwachsen:

root@acca:/tmp# umount /mnt
root@acca:/tmp# parted /dev/sdx print
Modell: Multiple Card Reader (scsi)
Festplatte  /dev/sdx:  64,4GB
Sektorgröße (logisch/physisch): 512B/512B
Partitionstabelle: msdos

Nummer  Anfang  Ende    Größe   Typ      Dateisystem  Flags
 1      1049kB  79,7MB  78,6MB  primary  fat32        boot
 2      79,7MB  930MB   850MB   primary  ext4
root@acca:/tmp# parted /dev/sdx resizepart 2 4000MB
Informationen: Möglicherweise müssen Sie /etc/fstab anpassen.             

root@acca:/tmp# parted /dev/sdx print
Modell: Multiple Card Reader (scsi)
Festplatte  /dev/sdx:  64,4GB
Sektorgröße (logisch/physisch): 512B/512B
Partitionstabelle: msdos

Nummer  Anfang  Ende    Größe   Typ      Dateisystem  Flags
 1      1049kB  79,7MB  78,6MB  primary  fat32        boot
 2      79,7MB  4000MB  3920MB  primary  ext4
root@acca:/tmp# resize2fs /dev/sdx2
resize2fs 1.42.8 (20-Jun-2013)
Bitte zuerst „e2fsck -f /dev/sdx2“ laufen lassen.

root@acca:/tmp# e2fsck -f /dev/sdx2
e2fsck 1.42.8 (20-Jun-2013)
Durchgang 1: Prüfe Inodes, Blocks und Größen
Durchgang 2: Prüfe die Verzeichnisstruktur
Durchgang 3: Prüfe Verzeichnis-Verknüpfungen
Durchgang 4: Überprüfe die Referenzzähler
Durchgang 5: Überprüfe die zusammengefasste Gruppeninformation
/dev/sdx2: 30506/51968 Dateien (0.1% nicht zusammenhängend), 136474/207616 Blöcke
root@acca:/tmp# resize2fs /dev/sdx2
resize2fs 1.42.8 (20-Jun-2013)
Die Grösse des Dateisystems auf /dev/sdx2 wird auf 957106 (4k) Blöcke geändert.

Das Dateisystem auf /dev/sdx2 ist nun 957106 Blöcke groß.

Bootloader

Damit man das Image des Sticks baukastenartig zusammenbauen kann, macht es Sinn, den Bootloader und die Partitionen getrennt voneinander zu behandeln.

Bootloader lesen:

dd if=/dev/sdx bs=446 count=1 of=rpi_bootsector.bin

Bootloader schreiben:

dd of=/dev/sdx bs=446 count=1 if=rpi_bootsector.bin