User Tools

Site Tools


sles_12_update_schulung

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
sles_12_update_schulung [2016/07/14 11:38] michaelsles_12_update_schulung [2021/04/24 07:40] (current) – external edit 127.0.0.1
Line 1: Line 1:
-====== Übgungsaufgabe 1 (Startskripte): ======+====== Startskripte ======
  
  
Line 24: Line 24:
      
      
-====== Übung 2: chkconfig ======+====== chkconfig ======
  
  
Line 64: Line 64:
  
  
-====== Übung 3 Eigener Runlevel ======+====== Eigener Runlevel ======
  
    96  2016-07-14 11:41:38 cp -P ../rc3.d/* .    96  2016-07-14 11:41:38 cp -P ../rc3.d/* .
Line 249: Line 249:
   display-manager.service                                                                   loaded active running X Display Manager   display-manager.service                                                                   loaded active running X Display Manager
   getty@tty1.service                                                                        loaded active running Getty on tty1   getty@tty1.service                                                                        loaded active running Getty on tty1
 +
 +
 +====== Wichtige Befehle ======
 +
 +  systemctl status --type=service
 +  systemctl enable/disable xy.service
 +  systemctl start/stop xy.service
 +  systemctl mask xy.service
 +aktive Dienste
 +  systemctl list-units --type=service
 +vorhandene Dienste
 +  systemctl list-units-files --type=service
 +Konfig Datei editieren
 +  systemctl edit nginx.service
 +Alle aktiven Runlevel anzeigen
 +  systemctl list-units --type=target
 +Alle vorhandenen  
 +  systemctl list-unit-files --type=target
 +Dienste eines Targets abfrage
 +  systemctl | show -p "Wants" target-name.target | less, oder:
 +  systemctl show target-name.target | grep Want  
 +
 +
 +====== Partitionen von Platte 1 auf Platte 2 klonen: ======
 +
 +
 +linux-tmer:~ # sfdisk -d /dev/sdb | sfdisk /dev/sdc
 +sfdisk: Checking that no-one is using this disk right now ...
 +sfdisk: OK
 +
 +Disk /dev/sdc: 1305 cylinders, 255 heads, 63 sectors/track
 +sfdisk:  /dev/sdc: unrecognized partition table type
 +Old situation:
 +sfdisk: No partitions found
 +sfdisk: Warning: extended partition does not start at a cylinder boundary.
 +DOS and Linux will interpret the contents differently.
 +New situation:
 +Units: sectors of 512 bytes, counting from 0
 +
 +   Device Boot    Start       End   #sectors  Id  System
 +/dev/sdc1          2048   4196351    4194304  83  Linux
 +/dev/sdc2       4196352   8390655    4194304  83  Linux
 +/dev/sdc3       8390656  20971519   12580864    Extended
 +/dev/sdc4                              0    Empty
 +/dev/sdc5       8392704  10489855    2097152  83  Linux
 +/dev/sdc6      10491904  12589055    2097152  83  Linux
 +/dev/sdc7      12591104  14688255    2097152  83  Linux
 +/dev/sdc8      14690304  16787455    2097152  83  Linux
 +sfdisk: Warning: partition 1 does not end at a cylinder boundary
 +sfdisk: Warning: partition 2 does not start at a cylinder boundary
 +sfdisk: Warning: partition 2 does not end at a cylinder boundary
 +sfdisk: Warning: partition 3 does not start at a cylinder boundary
 +sfdisk: Warning: partition 3 does not end at a cylinder boundary
 +sfdisk: Warning: partition 5 does not end at a cylinder boundary
 +sfdisk: Warning: partition [6] does not start at a cylinder boundary
 +sfdisk: Warning: partition [6] does not end at a cylinder boundary
 +sfdisk: Warning: partition 6 does not end at a cylinder boundary
 +sfdisk: Warning: partition [7] does not start at a cylinder boundary
 +sfdisk: Warning: partition [7] does not end at a cylinder boundary
 +sfdisk: Warning: partition 7 does not end at a cylinder boundary
 +sfdisk: Warning: partition [8] does not start at a cylinder boundary
 +sfdisk: Warning: partition [8] does not end at a cylinder boundary
 +sfdisk: Warning: partition 8 does not end at a cylinder boundary
 +sfdisk: Warning: no primary partition is marked bootable (active)
 +This does not matter for LILO, but the DOS MBR will not boot this disk.
 +Successfully wrote the new partition table
 +
 +Re-reading the partition table ...
 +
 +sfdisk: If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
 +to zero the first 512 bytes:  dd if=/dev/zero of=/dev/foo7 bs=512 count=1
 +(See fdisk(8).)
 +
 +ext3 platte etc: max-mount auf 0 Setzen. sonst kann es zu fsck kommen. -I intervall 0
 +
 +
 +
 +linux-tmer:~ # tune2fs  -l /dev/sdb7
 +
 +
 +Dateisysteme vergrößern nach vergrößern der Partition:
 +
 +ext2/3/4:
 +  resize2fs device
 +
 +  SLES12:~ # resize2fs /dev/vg02/lv201
 +  resize2fs 1.42.11 (09-Jul-2014)
 +  Filesystem at /dev/vg02/lv201 is mounted on /mnt; on-line resizing required
 +  old_desc_blocks = 1, new_desc_blocks = 2
 +  The filesystem on /dev/vg02/lv201 is now 360448 blocks long.
 +
 +
 +xfs:
 +  xfs_growfs device
 +  
 +  
 +====== LVM  ======
 +
 +Create Physical Volume
 +SLES12:~ # pvcreate /dev/sdb1
 +  Physical volume "/dev/sdb1" successfully created
 +
 +
 +== Create Volume Group ==
 +
 +SLES12:~ # vgcreate vg01 /dev/sdb1
 +  Volume group "vg01" successfully created
 +SLES12:~ #
 +
 +== Create logical Volumes ==
 +
 +SLES12:~ # lvcreate -n lv101 -L 400M vg01
 +  Logical volume "lv101" created.
 +SLES12:~ # lvcreate -n lv102 -L 500M vg01
 +  Logical volume "lv102" created.
 +SLES12:~ #
 +
 +
 +== Create additional Swap ==
 +
 +SLES12:~ #
 +SLES12:~ # mkswap /dev/vg01/lv102
 +Setting up swapspace version 1, size = 511996 KiB
 +no label, UUID=523b3c51-55fa-4361-b5e0-7bfb596dce9e
 +SLES12:~ #
 +
 +== Aktivate Swap ==
 +
 +SLES12:~ # swapon /dev/vg01/lv102
 +SLES12:~ #
 +SLES12:~ #
 +
 +
 +== Check if swap is aktivated ==
 +
 +SLES12:~ # swapon -s
 +Filename                                Type            Size    Used    Priority
 +/dev/sda1                               partition       2103292 0       -1
 +/dev/dm-1                               partition       511996  0       -2
 +SLES12:~ #
 +
 +== Erstellen eines ext3 Filesystems ==
 +
 +SLES12:~ # mke2fs -j /dev/vg01/lv101
 +mke2fs 1.42.11 (09-Jul-2014)
 +Creating filesystem with 409600 1k blocks and 102400 inodes
 +Filesystem UUID: e9ebd313-7641-4a4c-8c45-e71739794b25
 +Superblock backups stored on blocks:
 +        8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
 +
 +Allocating group tables: done
 +Writing inode tables: done
 +Creating journal (8192 blocks): done
 +Writing superblocks and filesystem accounting information: done
 +
 +== Mount formatted Filesystem, copy /usr/bin/ and "overmount" /usr/bin" ==
 +
 +SLES12:~ #
 +SLES12:~ # mount /dev/vg01/lv101 /mnt/
 +SLES12:~ #
 +SLES12:~ # cp -R /usr/bin/* /mnt/
 +SLES12:~ #
 +SLES12:~ # umount /mnt
 +SLES12:~ #
 +SLES12:~ # mount /dev/vg01/lv101 /usr/bin/
 +SLES12:~ #
 +
 +
 +== List the VG and look for free PE ==
 +
 +SLES12:~ # vgdisplay -v
 +    Using volume group(s) on command line.
 +  --- Volume group ---
 +  VG Name               vg01
 +  System ID
 +  Format                lvm2
 +  Metadata Areas        1
 +  Metadata Sequence No  3
 +  VG Access             read/write
 +  VG Status             resizable
 +  MAX LV                0
 +  Cur LV                2
 +  Open LV               2
 +  Max PV                0
 +  Cur PV                1
 +  Act PV                1
 +  VG Size               2.00 GiB
 +  PE Size               4.00 MiB
 +  Total PE              511
 +  Alloc PE / Size       225 / 900.00 MiB
 +  Free  PE / Size       286 / 1.12 GiB
 +  VG UUID               0WVhD5-yVVR-m7SG-uqDR-lp04-5GHl-qLExwD
 +
 +  --- Logical volume ---
 +  LV Path                /dev/vg01/lv101
 +  LV Name                lv101
 +  VG Name                vg01
 +  LV UUID                yBT0Vq-w2Am-CfnX-cmCo-8n39-GySx-HQgHkT
 +  LV Write Access        read/write
 +  LV Creation host, time SLES12, 2016-07-15 10:05:52 +0200
 +  LV Status              available
 +  # open                 1
 +  LV Size                400.00 MiB
 +  Current LE             100
 +  Segments               1
 +  Allocation             inherit
 +  Read ahead sectors     auto
 +  - currently set to     1024
 +  Block device           254:0
 +
 +  --- Logical volume ---
 +  LV Path                /dev/vg01/lv102
 +  LV Name                lv102
 +  VG Name                vg01
 +  LV UUID                zVqjlO-kdfz-xliL-znpJ-Mgb1-4FFi-jUHYoW
 +  LV Write Access        read/write
 +  LV Creation host, time SLES12, 2016-07-15 10:05:59 +0200
 +  LV Status              available
 +  # open                 2
 +  LV Size                500.00 MiB
 +  Current LE             125
 +  Segments               1
 +  Allocation             inherit
 +  Read ahead sectors     auto
 +  - currently set to     1024
 +  Block device           254:1
 +
 +  --- Physical volumes ---
 +  PV Name               /dev/sdb1
 +  PV UUID               1OGKSL-xxQk-zGPx-Yf8T-6W3s-yATQ-yplBhx
 +  PV Status             allocatable
 +  Total PE / Free PE    511 / 286
 +
 +SLES12:~ #
 +
 +== Fragmentierung einer Datei ==
 +
 +SLES12:/mnt # filefrag -v services
 +Filesystem type is: ef53
 +Filesystem cylinder groups approximately 16
 +File size of services is 1263621 (309 blocks of 4096 bytes)
 + ext:     logical_offset:        physical_offset: length:   expected: flags:
 +   0:        0..      15:       1024..      1039:     16:             merged
 +   1:       16..      63:        688..       735:     48:       1040: merged
 +   2:       64..     127:        768..       831:     64:        736: merged
 +   3:      128..     255:        896..      1023:    128:        832: merged
 +   4:      256..     308:       1664..      1716:     53:       1024: last,merged,eof
 +services: 5 extents found
 +
 +====== BTRFS ======
 +
 +SLES12:/ #  mkfs.btrfs -f /dev/sdc1 /dev/sdc8
 +btrfs-progs v4.1.2+20151002
 +See http://btrfs.wiki.kernel.org for more information.
 +
 +Label:              (null)
 +UUID:               **ac33d521-eec2-4ab5-b3c9-59d661d5e2e8**
 +Node size:          16384
 +Sector size:        4096
 +Filesystem size:    3.00GiB
 +Block group profiles:
 +  Data:             RAID0           315.12MiB
 +  Metadata:         RAID1           161.56MiB
 +  System:           RAID1            12.00MiB
 +SSD detected:       no
 +Incompat features:  extref, skinny-metadata
 +Number of devices:  2
 +Devices:
 +   ID        SIZE  PATH
 +    1     2.00GiB  /dev/sdc1
 +    2     1.00GiB  /dev/sdc8
 +
 +
 +== Mounten des Filesystems via uuid ==
 +
 +
 +SLES12:/mnt # mount /dev/disk/by-uuid/da8e5d24-9f2a-431e-a3e5-b3288ba7d0dc /mnt/NEU/
 +SLES12:/mnt #
 +SLES12:/mnt/NEU # btrfs filesystem show /mnt/NEU/
 +Label: 'btfilesys'  uuid: da8e5d24-9f2a-431e-a3e5-b3288ba7d0dc
 +        Total devices 2 FS bytes used 256.00KiB
 +        devid    1 size 2.00GiB used 327.12MiB path /dev/sdc1
 +        devid    2 size 1.00GiB used 315.12MiB path /dev/sdc8
 +
 +btrfs-progs v4.1.2+20151002
 +
 +
 +SLES12:/mnt/NEU # btrfs device add -f /dev/sdc2 /mnt/NEU
 +SLES12:/mnt/NEU #
 +SLES12:/mnt/NEU #
 +SLES12:/mnt/NEU # btrfs filesystem show /mnt/NEU/
 +Label: 'btfilesys'  uuid: da8e5d24-9f2a-431e-a3e5-b3288ba7d0dc
 +        Total devices 3 FS bytes used 256.00KiB
 +        devid    1 size 2.00GiB used 327.12MiB path /dev/sdc1
 +        devid    2 size 1.00GiB used 315.12MiB path /dev/sdc8
 +        devid    3 size 2.00GiB used 0.00B path /dev/sdc2
 +
 +
 +
 +SLES12:/mnt/NEU # btrfs filesystem show /mnt/NEU
 +Label: 'btfilesys'  uuid: da8e5d24-9f2a-431e-a3e5-b3288ba7d0dc
 +        Total devices 3 FS bytes used 256.00KiB
 +        devid    1 size 2.00GiB used 327.12MiB path /dev/sdc1
 +        devid    2 size 1.00GiB used 315.12MiB path /dev/sdc8
 +        devid    3 size 2.00GiB used 0.00B path /dev/sdc2
 +
 +btrfs-progs v4.1.2+20151002
 +
 +== Testdaten auf das Filesystem kopieren ==
 +
 +SLES12:/mnt/NEU # cp -R /usr/lib/* .
 +SLES12:/mnt/NEU #
 +SLES12:/mnt/NEU #
 +SLES12:/mnt/NEU # btrfs filesystem show /mnt/NEU
 +Label: 'btfilesys'  uuid: da8e5d24-9f2a-431e-a3e5-b3288ba7d0dc
 +        Total devices 3 FS bytes used 86.88MiB
 +        devid    1 size 2.00GiB used 503.12MiB path /dev/sdc1
 +        devid    2 size 1.00GiB used 491.12MiB path /dev/sdc8
 +        devid    3 size 2.00GiB used 176.00MiB path /dev/sdc2
 +
 +btrfs-progs v4.1.2+20151002
 +
 +== Ein Volume aus dem btrfs Filesystem löschen ==
 +
 +
 +SLES12:/mnt/NEU # btrfs device delete /dev/sdc2 /mnt/NEU/
 +SLES12:/mnt/NEU #
 +SLES12:/mnt/NEU #
 +SLES12:/mnt/NEU # btrfs filesystem show /mnt/NEU
 +Label: 'btfilesys'  uuid: da8e5d24-9f2a-431e-a3e5-b3288ba7d0dc
 +        Total devices 2 FS bytes used 792.45MiB
 +        devid    1 size 2.00GiB used 647.12MiB path /dev/sdc1
 +        devid    2 size 1.00GiB used 635.12MiB path /dev/sdc8
 +
 +
 +== Reduzieren des Filesystems um 500M ==
 +
 +
 +SLES12:/mnt/NEU # btrfs filesystem resize -500M /mnt/NEU/
 +Resize '/mnt/NEU/' of '-500M'
 +SLES12:/mnt/NEU #
 +SLES12:/mnt/NEU #
 +SLES12:/mnt/NEU # btrfs filesystem show /mnt/NEU
 +Label: 'btfilesys'  uuid: da8e5d24-9f2a-431e-a3e5-b3288ba7d0dc
 +        Total devices 2 FS bytes used 792.33MiB
 +        devid    1 size 1.51GiB used 647.12MiB path /dev/sdc1
 +        devid    2 size 1.00GiB used 635.12MiB path /dev/sdc8
 +
 +
 +== Informationen über die Belegung ausgeben ==
 +
 +SLES12:/mnt/NEU # btrfs filesystem df /mnt/NEU/
 +Data, RAID0: total=947.12MiB, used=778.25MiB
 +System, RAID1: total=8.00MiB, used=16.00KiB
 +System, single: total=4.00MiB, used=0.00B
 +Metadata, RAID1: total=153.56MiB, used=14.06MiB
 +Metadata, single: total=8.00MiB, used=0.00B
 +GlobalReserve, single: total=16.00MiB, used=0.00B
 +
 +== Filesystem ausbalancieren ==
 +
 +btrfs balance start /mnt
 +btrfs balance status /mnt
 +btrfs balance cancel /mnt
 +btrfs balance pause /mnt
 +btrfs balance resume /mnt
 +
 +== Snapshots ==
 +
 +Subvolume2 unterhalb Subvolume1, wird beim snap von Subvolume1 _nicht_ mitgesnapped
 +
 +
 +SLES12:/mnt/NEU/test # btrfs subvolume snapshot /mnt/NEU/test/subvolume /mnt/NEU/test/subvolume/snap
 +Create a snapshot of '/mnt/NEU/test/subvolume' in '/mnt/NEU/test/subvolume/snap'
 +
 +SLES12:/mnt/NEU/test/subvolume # ls -lR
 +.:
 +total 4
 +drwxr-xr-x 1 root root    6 Jul 15 12:48 ordner1
 +-rw-r--r-- 1 root root** 2929** Jul 15 12:53 passwd
 +drwxr-xr-x 1 root root   26 Jul 15 12:48 snap
 +
 +./ordner1:
 +total 0
 +-rw-r--r-- 1 root root 0 Jul 15 12:48 abc
 +
 +./snap:
 +total 4
 +drwxr-xr-x 1 root root    6 Jul 15 12:48 ordner1
 +-rw-r--r-- 1 root root **1633** Jul 15 12:48 passwd
 +
 +./snap/ordner1:
 +total 0
 +-rw-r--r-- 1 root root 0 Jul 15 12:48 abc
 +
 +
 +cp --reflink
 +       --reflink[=WHEN]
 +       control clone/CoW copies. See below
 +
 +       When --reflink[=always] is specified, perform a lightweight copy, where the data blocks are copied only when modified.  If this is not possible the copy fails, or if
 +       --reflink=auto is specified, fall back to a standard copy.
 +
 +
 +
 +SLES12:/ # snapper list
 +Type   | # | Pre # | Date                     | User | Cleanup | Description           | Userdata
 +-------+---+-------+--------------------------+------+---------+-----------------------+--------------
 +single | 0 |                                | root |         | current               |
 +single | 1 |       | Tue Mar 15 12:29:47 2016 | root |         | first root filesystem |
 +single | 2 |       | Tue Mar 15 12:40:02 2016 | root | number  | after installation    | important=yes
 +pre    | 3 |       | Thu Jul 14 12:22:57 2016 | root | number  | yast firewall         |
 +post   | 4 | 3     | Thu Jul 14 12:23:18 2016 | root | number  |                       |
 +single | 5 |       | Fri Jul 15 15:03:51 2016 | root |                               |
 +
 +
 +SLES12:/ # snapper diff 3..4
 +--- /.snapshots/3/snapshot/etc/sysconfig/SuSEfirewall2  2016-03-15 12:39:22.240000500 +0100
 ++++ /.snapshots/4/snapshot/etc/sysconfig/SuSEfirewall2  2016-07-14 12:23:18.107298481 +0200
 +@@ -318,7 +318,7 @@
 + # FW_SERVICES_ACCEPT_*
 + #
 + # Example: "samba-server nfs-kernel-server"
 +-FW_CONFIGURATIONS_EXT=""
 ++FW_CONFIGURATIONS_EXT="sshd"
 +
 + ## Type:       string
 + #
 +@@ -1068,7 +1068,7 @@
 + #
 + # See also FW_SERVICES_ACCEPT_RELATED_EXT
 + #
 +-FW_LOAD_MODULES=""
 ++FW_LOAD_MODULES="nf_conntrack_netbios_ns"
 +
 + ## Type:       string
 + ## Default:
 +Binary files /.snapshots/3/snapshot/root/.local/share/gvfs-metadata/home and /.snapshots/4/snapshot/root/.local/share/gvfs-metadata/home differ
 +Binary files /.snapshots/3/snapshot/root/.local/share/gvfs-metadata/home-65f4037a.log and /.snapshots/4/snapshot/root/.local/share/gvfs-metadata/home-65f4037a.log differ
 +Binary files /.snapshots/3/snapshot/root/.local/share/gvfs-metadata/home-92bf047e.log and /.snapshots/4/snapshot/root/.local/share/gvfs-metadata/home-92bf047e.log differ
 +
 +
 +SLES12:/etc # snapper diff 6..7 /etc/resolv.conf
 +--- /.snapshots/6/snapshot/etc/resolv.conf      2016-07-15 10:04:25.000638268 +0200
 ++++ /.snapshots/7/snapshot/etc/resolv.conf      2016-07-15 15:21:40.169334418 +0200
 +@@ -17,5 +17,3 @@
 + # file and in case of a "netconfig update -f" call.
 + #
 + ### Please remove (at least) this line when you modify the file!
 +-search localdomain
 +-nameserver 192.168.24.2
 +
 +== Zurückgehen auf einen vorherigen Stand ==
 +SLES12:/etc # snapper undochange 6..7
 +create:12 modify:3 delete:0
  
  
  
sles_12_update_schulung.1468496282.txt.gz · Last modified: 2021/04/24 07:38 (external edit)