piątek, 14 sierpnia 2015

LVM

Create


This example creates an LVM logical volume called new_logical_volume that consists of the disks at /dev/sda1, /dev/sdb1, and /dev/sdc1.

5.1.1. Creating the Physical Volumes



[root@tng3-1 ~]# pvcreate /dev/sda1 /dev/sdb1 /dev/sdc1
  Physical volume "/dev/sda1" successfully created
  Physical volume "/dev/sdb1" successfully created
  Physical volume "/dev/sdc1" successfully created

5.1.2. Creating the Volume Group

The following command creates the volume group new_vol_group.
[root@tng3-1 ~]# vgcreate new_vol_group /dev/sda1 /dev/sdb1 /dev/sdc1
  Volume group "new_vol_group" successfully created
You can use the vgs command to display the attributes of the new volume group.
[root@tng3-1 ~]# vgs
  VG            #PV #LV #SN Attr   VSize  VFree
  new_vol_group   3   0   0 wz--n- 51.45G 51.45G

5.1.3. Creating the Logical Volume

The following command creates the logical volume new_logical_volume from the volume group new_vol_group. This example creates a logical volume that uses 2GB of the volume group.
[root@tng3-1 ~]# lvcreate -L2G -n new_logical_volume new_vol_group
  Logical volume "new_logical_volume" created

5.1.4. Creating the File System

The following command creates a GFS file system on the logical volume. np:
[root@tng3-1 ~]# gfs_mkfs -plock_nolock -j 1 /dev/new_vol_group/new_logical_volume
This will destroy any data on /dev/new_vol_group/new_logical_volume.

Are you sure you want to proceed? [y/n] y

Device:                    /dev/new_vol_group/new_logical_volume
Blocksize:                 4096
Filesystem Size:           491460
Journals:                  1
Resource Groups:           8
Locking Protocol:          lock_nolock
Lock Table:

Syncing...
All Done
The following commands mount the logical volume and report the file system disk space usage.
[root@tng3-1 ~]# mount /dev/new_vol_group/new_logical_volume /mnt
[root@tng3-1 ~]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/new_vol_group/new_logical_volume
                       1965840        20   1965820   1% /mnt 
 
 
 
Rozszerzenie Phisical volume  
 
echo 1 > /sys/block/sdX/device/rescan
  
 
[root@centos7 ~]# pvs
  PV         VG           Fmt  Attr PSize   PFree
  /dev/sda2  centos       lvm2 a--   59.51g 64.00m
  /dev/sdb   vol_group_sk lvm2 a--  160.00g 10.00g
[root@centos7 ~]# pvresize /dev/sdb
  Physical volume "/dev/sdb" changed
  1 physical volume(s) resized / 0 physical volume(s) not resized
[root@centos7 ~]# pvs
  PV         VG           Fmt  Attr PSize   PFree
  /dev/sda2  centos       lvm2 a--   59.51g 64.00m
  /dev/sdb   vol_group_sk lvm2 a--  210.00g 60.00g
[root@centos7 ~]#
 
  
 
 
Rozszerz LVM logical volume

# lvextend -L12G /dev/myvg/homevol
 
 
Najpierw zrób:
e2fsck -f /dev/myvg/homevol/dev/myvg/homevol 
 
 
ext2/ext3
          
umount /dev/myvg/homevol/dev/myvg/homevol
   # resize2fs /dev/myvg/homevol         # wykonuj na zamontowanym zasobie 
   # mount /dev/myvg/homevol /home
 umount /dev/myvg/homevol/dev/myvg/homevol
   # ext2resize /dev/myvg/homevol       # wykonuj na zamontowanym zasobie 
   # mount /dev/myvg/homevol /home
 
xfs
mount /dev/myvg/homevol /home
xfs_growfs /home        # wykonuj na zamontowanym zasobie 
 
df -h  
 
 
Rozszerz LVM volume group
 
vgextend new_vol_group /dev/sdd
 
 
 Usuń uszkodzony dysk z volume group
 
 
# pvs -o+pv_used
Sprawdz zajętość dysków

# pvmove /dev/sdb1

przenieść dane z dysku do wymiany
/dev/sdb1: Moved: 2.0% ...
/dev/sdb1: Moved: 79.2% ...
/dev/sdb1: Moved: 100.0%

# pvs -o+pv_used
 Sprawdz zajętość dysków
 
# vgreduce myvg /dev/sdb1
Wypnij dysk z grupy

czwartek, 13 sierpnia 2015

Red Hat & Ubuntu reset root password

REDHAT
 
- init.d
W Grub Press "e"
linia kernel... Press "e" na końcu space i 1
Enter
Pres "b"
passwd

- system.d
W Grub Press "e"

linia linux16....znajdz
rhgb quite LANG
i zmien na
rhgb quite rd.break LANG
Ctrl + x

Jak wyskoczy Promt #
mount -o remount,rw /sysroot/
chroot /sysroot/
passwd


UBUNTU 14

Albo tryb recovery i potem
mount -o remount,rw /
chroot /

Albo:
  1. Select (highlight) the GRUB boot menu entry you wish to use.
  2. Press e to edit the GRUB boot commands for the selected boot menu entry.
  3. Look near the bottom of the list of commands for lines similar to

    linux /boot/vmlinuz-3.2.0-24-generic root=UUID=bc6f8146-1523-46a6-8b\
    6a-64b819ccf2b7 ro quiet splash
    initrd /boot/initrd.img-3.2.0-24-generic
  4. Change the middle line in (3) by adding the kernel boot parameter single to the end of the line (i.e. after ro quiet splash).

    For this example you would change
    6a-64b819ccf2b7 ro quiet splash
    to
    6a-64b819ccf2b7 ro quiet splash single
  5. Press either Ctrl+X or F10 to boot using these kernel options.