# vim /usr/share/gnome-shell/theme/gnome-shell.css
/* PopupMenu */
.popup-menu-boxpointer,
.candidate-popup-boxpointer {
-arrow-border-radius: 8px;
-arrow-background-color: rgba(0,0,0,0.9); # Panel popup menu background and transparency
-arrow-border-width: 1px; # Panel popup menu border width
-arrow-border-color: black;
-arrow-base: 24px;
-arrow-rise: 11px;
Wednesday, July 31, 2013
Friday, April 26, 2013
LVM : How to extend an active logical volume?
Important: This
is not a definite guide. Use LVM tools with caution and always have
a backup before you modify anything. Improper use of those tools may
destroy all your data and I do not take any responsibility of that. You
were warned.
In this case we will add new PV (physical volume) to the existing VG (volume group) to extend an existing LV (logical volume) containing user home directories and mounted under /home. Both, the existing and a new PV are LUKS encrypted partitions. See my previous post LUKS : How to encrypt a partition? if you need to prepare the LUKS encrypted device first.
Check the current LVM setup
[root@cmstorm home]# lvs
LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert
home vg_home -wi-ao-- 232.88g
root vg_root -wi-ao-- 347.62g
swap vg_root -wi-ao-- 17.62g
[root@cmstorm home]# lvdisplay vg_home
--- Logical volume ---
LV Path /dev/vg_home/home
LV Name home
VG Name vg_home
LV UUID hd4N00-VKbv-47Hh-pTQ3-VH1m-6dEf-uukfDp
LV Write Access read/write
LV Creation host, time cmstorm.localdomain, 2012-10-06 04:22:45 +0100
LV Status available
# open 1
LV Size 232.88 GiB
Current LE 7452
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:3
[root@cmstorm home]# vgdisplay vg_home
--- Volume group ---
VG Name vg_home
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 2
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 1
Act PV 1
VG Size 232.88 GiB
PE Size 32.00 MiB
Total PE 7452
Alloc PE / Size 7452 / 232.88 GiB
Free PE / Size 0 / 0
VG UUID IuoMBo-r2OD-D7Sg-U9dl-TbS6-3rFj-pcX5P7
[root@cmstorm home]# pvs
PV VG Fmt Attr PSize PFree
/dev/mapper/luks-e78b92c8-26a5-415b-9f95-c56aa9e511ca vg_home lvm2 a-- 232.88g 0
/dev/sdb5 vg_root lvm2 a-- 365.25g 0
[root@cmstorm home]# pvdisplay
--- Physical volume ---
PV Name /dev/sdb5
VG Name vg_root
PV Size 365.27 GiB / not usable 22.00 MiB
Allocatable yes (but full)
PE Size 32.00 MiB
Total PE 11688
Free PE 0
Allocated PE 11688
PV UUID OUOFIT-KRPR-qnOK-yeKC-Me2y-NGn4-WeWqyR
--- Physical volume ---
PV Name /dev/mapper/luks-e78b92c8-26a5-415b-9f95-c56aa9e511ca
VG Name vg_home
PV Size 232.88 GiB / not usable 8.00 MiB
Allocatable yes (but full)
PE Size 32.00 MiB
Total PE 7452
Free PE 0
Allocated PE 7452
PV UUID Er1gKd-L20a-320j-EdGy-lbcl-szwz-hpVvDe
[root@cmstorm home]# pvdisplay /dev/mapper/luks-e78b92c8-26a5-415b-9f95-c56aa9e511ca
--- Physical volume ---
PV Name /dev/mapper/luks-e78b92c8-26a5-415b-9f95-c56aa9e511ca
VG Name vg_home
PV Size 232.88 GiB / not usable 8.00 MiB
Allocatable yes (but full)
PE Size 32.00 MiB
Total PE 7452
Free PE 0
Allocated PE 7452
PV UUID Er1gKd-L20a-320j-EdGy-lbcl-szwz-hpVvDe
[root@cmstorm home]# ls /dev/mapper/luks-cba6febb-91cb-456e-afcf-0a16e89e4cae
luks-e78b92c8-26a5-415b-9f95-c56aa9e511ca
Create a new physical volume (PV) from the LUKS encrypted device
[root@cmstorm home]# pvcreate /dev/mapper/luks-cba6febb-91cb-456e-afcf-0a16e89e4cae
Writing physical volume data to disk "/dev/mapper/luks-cba6febb-91cb-456e-afcf-0a16e89e4cae"
Physical volume "/dev/mapper/luks-cba6febb-91cb-456e-afcf-0a16e89e4cae" successfully created
[root@cmstorm home]# pvs
PV VG Fmt Attr PSize PFree
/dev/mapper/luks-cba6febb-91cb-456e-afcf-0a16e89e4cae lvm2 a-- 931.51g 931.51g
/dev/mapper/luks-e78b92c8-26a5-415b-9f95-c56aa9e511ca vg_home lvm2 a-- 232.88g 0
/dev/sdb5 vg_root lvm2 a-- 365.25g 0
[root@cmstorm home]# pvdisplay /dev/mapper/luks-cba6febb-91cb-456e-afcf-0a16e89e4cae
"/dev/mapper/luks-cba6febb-91cb-456e-afcf-0a16e89e4cae" is a new physical volume of "931.51 GiB"
--- NEW Physical volume ---
PV Name /dev/mapper/luks-cba6febb-91cb-456e-afcf-0a16e89e4cae
VG Name
PV Size 931.51 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID 8VRooy-YVJ1-KDqU-QFhk-GnvF-VbJt-uEbhRS
Add the new physical volume (PV) to the volume group (VG)
[root@cmstorm home]# vgextend vg_home /dev/mapper/luks-cba6febb-91cb-456e-afcf-0a16e89e4cae
Volume group "vg_home" successfully extended
[root@cmstorm home]# pvs
PV VG Fmt Attr PSize PFree
/dev/mapper/luks-cba6febb-91cb-456e-afcf-0a16e89e4cae vg_home lvm2 a-- 931.50g 931.50g
/dev/mapper/luks-e78b92c8-26a5-415b-9f95-c56aa9e511ca vg_home lvm2 a-- 232.88g 0
/dev/sdb5 vg_root lvm2 a-- 365.25g 0
[root@cmstorm home]# pvdisplay /dev/mapper/luks-cba6febb-91cb-456e-afcf-0a16e89e4cae
--- Physical volume ---
PV Name /dev/mapper/luks-cba6febb-91cb-456e-afcf-0a16e89e4cae
VG Name vg_home
PV Size 931.51 GiB / not usable 6.00 MiB
Allocatable yes
PE Size 32.00 MiB
Total PE 29808
Free PE 29808
Allocated PE 0
PV UUID 8VRooy-YVJ1-KDqU-QFhk-GnvF-VbJt-uEbhRS
Extend the logical volume (LV)
[root@cmstorm home]# lvextend -l +100%FREE /dev/vg_home/home
Extending logical volume home to 1.14 TiB
Logical volume home successfully resized
[root@cmstorm home]#
[root@cmstorm home]# pvdisplay
--- Physical volume ---
PV Name /dev/sdb5
VG Name vg_root
PV Size 365.27 GiB / not usable 22.00 MiB
Allocatable yes (but full)
PE Size 32.00 MiB
Total PE 11688
Free PE 0
Allocated PE 11688
PV UUID OUOFIT-KRPR-qnOK-yeKC-Me2y-NGn4-WeWqyR
--- Physical volume ---
PV Name /dev/mapper/luks-e78b92c8-26a5-415b-9f95-c56aa9e511ca
VG Name vg_home
PV Size 232.88 GiB / not usable 8.00 MiB
Allocatable yes (but full)
PE Size 32.00 MiB
Total PE 7452
Free PE 0
Allocated PE 7452
PV UUID Er1gKd-L20a-320j-EdGy-lbcl-szwz-hpVvDe
--- Physical volume ---
PV Name /dev/mapper/luks-cba6febb-91cb-456e-afcf-0a16e89e4cae
VG Name vg_home
PV Size 931.51 GiB / not usable 6.00 MiB
Allocatable yes (but full)
PE Size 32.00 MiB
Total PE 29808
Free PE 0
Allocated PE 29808
PV UUID 8VRooy-YVJ1-KDqU-QFhk-GnvF-VbJt-uEbhRS
[root@cmstorm home]# lvdisplay vg_home
--- Logical volume ---
LV Path /dev/vg_home/home
LV Name home
VG Name vg_home
LV UUID hd4N00-VKbv-47Hh-pTQ3-VH1m-6dEf-uukfDp
LV Write Access read/write
LV Creation host, time cmstorm.localdomain, 2012-10-06 04:22:45 +0100
LV Status available
# open 1
LV Size 1.14 TiB
Current LE 37260
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:3
[root@cmstorm home]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 7.9G 0 7.9G 0% /dev
tmpfs 7.9G 448K 7.9G 1% /dev/shm
tmpfs 7.9G 2.0M 7.9G 1% /run
/dev/mapper/vg_root-root 343G 12G 314G 4% /
tmpfs 7.9G 0 7.9G 0% /sys/fs/cgroup
tmpfs 7.9G 0 7.9G 0% /media
/dev/sdd1 459G 244G 192G 57% /mnt/WD10EAVS-EXT4
/dev/sdd2 466G 114G 352G 25% /mnt/WD10EAVS-NTFS
/dev/sdb3 477M 93M 359M 21% /boot
/dev/mapper/vg_home-home 230G 95G 123G 44% /home
The logical volume size is now 1.14TiB, but the /dev/mapper/vg_home-home filesystem is still 230G, so now you need to resize the file system to start using the new space.
[root@cmstorm home]# resize2fs /dev/vg_home/home
In this case we will add new PV (physical volume) to the existing VG (volume group) to extend an existing LV (logical volume) containing user home directories and mounted under /home. Both, the existing and a new PV are LUKS encrypted partitions. See my previous post LUKS : How to encrypt a partition? if you need to prepare the LUKS encrypted device first.
Check the current LVM setup
[root@cmstorm home]# lvs
LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert
home vg_home -wi-ao-- 232.88g
root vg_root -wi-ao-- 347.62g
swap vg_root -wi-ao-- 17.62g
[root@cmstorm home]# lvdisplay vg_home
--- Logical volume ---
LV Path /dev/vg_home/home
LV Name home
VG Name vg_home
LV UUID hd4N00-VKbv-47Hh-pTQ3-VH1m-6dEf-uukfDp
LV Write Access read/write
LV Creation host, time cmstorm.localdomain, 2012-10-06 04:22:45 +0100
LV Status available
# open 1
LV Size 232.88 GiB
Current LE 7452
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:3
[root@cmstorm home]# vgdisplay vg_home
--- Volume group ---
VG Name vg_home
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 2
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 1
Act PV 1
VG Size 232.88 GiB
PE Size 32.00 MiB
Total PE 7452
Alloc PE / Size 7452 / 232.88 GiB
Free PE / Size 0 / 0
VG UUID IuoMBo-r2OD-D7Sg-U9dl-TbS6-3rFj-pcX5P7
[root@cmstorm home]# pvs
PV VG Fmt Attr PSize PFree
/dev/mapper/luks-e78b92c8-26a5-415b-9f95-c56aa9e511ca vg_home lvm2 a-- 232.88g 0
/dev/sdb5 vg_root lvm2 a-- 365.25g 0
[root@cmstorm home]# pvdisplay
--- Physical volume ---
PV Name /dev/sdb5
VG Name vg_root
PV Size 365.27 GiB / not usable 22.00 MiB
Allocatable yes (but full)
PE Size 32.00 MiB
Total PE 11688
Free PE 0
Allocated PE 11688
PV UUID OUOFIT-KRPR-qnOK-yeKC-Me2y-NGn4-WeWqyR
--- Physical volume ---
PV Name /dev/mapper/luks-e78b92c8-26a5-415b-9f95-c56aa9e511ca
VG Name vg_home
PV Size 232.88 GiB / not usable 8.00 MiB
Allocatable yes (but full)
PE Size 32.00 MiB
Total PE 7452
Free PE 0
Allocated PE 7452
PV UUID Er1gKd-L20a-320j-EdGy-lbcl-szwz-hpVvDe
[root@cmstorm home]# pvdisplay /dev/mapper/luks-e78b92c8-26a5-415b-9f95-c56aa9e511ca
--- Physical volume ---
PV Name /dev/mapper/luks-e78b92c8-26a5-415b-9f95-c56aa9e511ca
VG Name vg_home
PV Size 232.88 GiB / not usable 8.00 MiB
Allocatable yes (but full)
PE Size 32.00 MiB
Total PE 7452
Free PE 0
Allocated PE 7452
PV UUID Er1gKd-L20a-320j-EdGy-lbcl-szwz-hpVvDe
[root@cmstorm home]# ls /dev/mapper/luks-cba6febb-91cb-456e-afcf-0a16e89e4cae
luks-e78b92c8-26a5-415b-9f95-c56aa9e511ca
Create a new physical volume (PV) from the LUKS encrypted device
[root@cmstorm home]# pvcreate /dev/mapper/luks-cba6febb-91cb-456e-afcf-0a16e89e4cae
Writing physical volume data to disk "/dev/mapper/luks-cba6febb-91cb-456e-afcf-0a16e89e4cae"
Physical volume "/dev/mapper/luks-cba6febb-91cb-456e-afcf-0a16e89e4cae" successfully created
[root@cmstorm home]# pvs
PV VG Fmt Attr PSize PFree
/dev/mapper/luks-cba6febb-91cb-456e-afcf-0a16e89e4cae lvm2 a-- 931.51g 931.51g
/dev/mapper/luks-e78b92c8-26a5-415b-9f95-c56aa9e511ca vg_home lvm2 a-- 232.88g 0
/dev/sdb5 vg_root lvm2 a-- 365.25g 0
[root@cmstorm home]# pvdisplay /dev/mapper/luks-cba6febb-91cb-456e-afcf-0a16e89e4cae
"/dev/mapper/luks-cba6febb-91cb-456e-afcf-0a16e89e4cae" is a new physical volume of "931.51 GiB"
--- NEW Physical volume ---
PV Name /dev/mapper/luks-cba6febb-91cb-456e-afcf-0a16e89e4cae
VG Name
PV Size 931.51 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID 8VRooy-YVJ1-KDqU-QFhk-GnvF-VbJt-uEbhRS
Add the new physical volume (PV) to the volume group (VG)
[root@cmstorm home]# vgextend vg_home /dev/mapper/luks-cba6febb-91cb-456e-afcf-0a16e89e4cae
Volume group "vg_home" successfully extended
[root@cmstorm home]# pvs
PV VG Fmt Attr PSize PFree
/dev/mapper/luks-cba6febb-91cb-456e-afcf-0a16e89e4cae vg_home lvm2 a-- 931.50g 931.50g
/dev/mapper/luks-e78b92c8-26a5-415b-9f95-c56aa9e511ca vg_home lvm2 a-- 232.88g 0
/dev/sdb5 vg_root lvm2 a-- 365.25g 0
[root@cmstorm home]# pvdisplay /dev/mapper/luks-cba6febb-91cb-456e-afcf-0a16e89e4cae
--- Physical volume ---
PV Name /dev/mapper/luks-cba6febb-91cb-456e-afcf-0a16e89e4cae
VG Name vg_home
PV Size 931.51 GiB / not usable 6.00 MiB
Allocatable yes
PE Size 32.00 MiB
Total PE 29808
Free PE 29808
Allocated PE 0
PV UUID 8VRooy-YVJ1-KDqU-QFhk-GnvF-VbJt-uEbhRS
Extend the logical volume (LV)
[root@cmstorm home]# lvextend -l +100%FREE /dev/vg_home/home
Extending logical volume home to 1.14 TiB
Logical volume home successfully resized
[root@cmstorm home]#
[root@cmstorm home]# pvdisplay
--- Physical volume ---
PV Name /dev/sdb5
VG Name vg_root
PV Size 365.27 GiB / not usable 22.00 MiB
Allocatable yes (but full)
PE Size 32.00 MiB
Total PE 11688
Free PE 0
Allocated PE 11688
PV UUID OUOFIT-KRPR-qnOK-yeKC-Me2y-NGn4-WeWqyR
--- Physical volume ---
PV Name /dev/mapper/luks-e78b92c8-26a5-415b-9f95-c56aa9e511ca
VG Name vg_home
PV Size 232.88 GiB / not usable 8.00 MiB
Allocatable yes (but full)
PE Size 32.00 MiB
Total PE 7452
Free PE 0
Allocated PE 7452
PV UUID Er1gKd-L20a-320j-EdGy-lbcl-szwz-hpVvDe
--- Physical volume ---
PV Name /dev/mapper/luks-cba6febb-91cb-456e-afcf-0a16e89e4cae
VG Name vg_home
PV Size 931.51 GiB / not usable 6.00 MiB
Allocatable yes (but full)
PE Size 32.00 MiB
Total PE 29808
Free PE 0
Allocated PE 29808
PV UUID 8VRooy-YVJ1-KDqU-QFhk-GnvF-VbJt-uEbhRS
[root@cmstorm home]# lvdisplay vg_home
--- Logical volume ---
LV Path /dev/vg_home/home
LV Name home
VG Name vg_home
LV UUID hd4N00-VKbv-47Hh-pTQ3-VH1m-6dEf-uukfDp
LV Write Access read/write
LV Creation host, time cmstorm.localdomain, 2012-10-06 04:22:45 +0100
LV Status available
# open 1
LV Size 1.14 TiB
Current LE 37260
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:3
[root@cmstorm home]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 7.9G 0 7.9G 0% /dev
tmpfs 7.9G 448K 7.9G 1% /dev/shm
tmpfs 7.9G 2.0M 7.9G 1% /run
/dev/mapper/vg_root-root 343G 12G 314G 4% /
tmpfs 7.9G 0 7.9G 0% /sys/fs/cgroup
tmpfs 7.9G 0 7.9G 0% /media
/dev/sdd1 459G 244G 192G 57% /mnt/WD10EAVS-EXT4
/dev/sdd2 466G 114G 352G 25% /mnt/WD10EAVS-NTFS
/dev/sdb3 477M 93M 359M 21% /boot
/dev/mapper/vg_home-home 230G 95G 123G 44% /home
The logical volume size is now 1.14TiB, but the /dev/mapper/vg_home-home filesystem is still 230G, so now you need to resize the file system to start using the new space.
[root@cmstorm home]# resize2fs /dev/vg_home/home
Thursday, April 25, 2013
LUKS : How to encrypt a partition?
Important: This
is not a definite guide. Use LUKS with caution and always have
a backup before you modify anything. Improper use of LUKS may
destroy all your data and I do not take any responsibility of that. You
were warned.
Check if a partition is already encrypted with LUKS
[root@cmstorm home]# cryptsetup isLuks /dev/sda1 && echo Yes
[root@cmstorm home]#
Fill the device with random data
# dd if=/dev/urandom of=/dev/sda1
or
# badblocks -c 10240 -s -w -t random -v /dev/sda1
Encrypt the partition
[root@cmstorm home]# cryptsetup luksFormat /dev/sda1
WARNING!
========
This will overwrite data on /dev/sda1 irrevocably.
Are you sure? (Type uppercase yes): YES
Enter LUKS passphrase:
Verify passphrase:
[root@cmstorm home]# cryptsetup isLuks /dev/sda1 && echo Yes
Yes
[root@cmstorm home]# cryptsetup luksDump /dev/sda1
LUKS header information for /dev/sda1
Version: 1
Cipher name: aes
Cipher mode: cbc-essiv:sha256
Hash spec: sha1
Payload offset: 4096
MK bits: 256
MK digest: b9 2d fd e6 d2 ab 1b 83 9c 4e 26 36 ba b7 a0 62 a9 49 b7 59
MK salt: 35 79 84 53 ce 26 0a 3c da 1a cc a0 c0 fc 4f 1f
c1 82 91 2e 3c df f2 44 63 e7 f2 b6 42 a6 11 3b
MK iterations: 72875
UUID: cba6febb-91cb-456e-afcf-0a16e89e4cae
Key Slot 0: ENABLED
Iterations: 291655
Salt: fd e6 dc 28 4f 68 ed 56 10 19 80 2c 74 33 1b 55
e9 8e 12 7c 08 be 24 0d 97 f5 f2 fd fb 21 65 01
Key material offset: 8
AF stripes: 4000
Key Slot 1: DISABLED
Key Slot 2: DISABLED
Key Slot 3: DISABLED
Key Slot 4: DISABLED
Key Slot 5: DISABLED
Key Slot 6: DISABLED
Key Slot 7: DISABLED
Open the encrypted device and create mapping
[root@cmstorm home]# cryptsetup luksUUID /dev/sda1
cba6febb-91cb-456e-afcf-0a16e89e4cae
[root@cmstorm home]# cryptsetup luksOpen /dev/sda1 luks-cba6febb-91cb-456e-afcf-0a16e89e4cae
Enter passphrase for /dev/sda1:
[root@cmstorm home]# ll /dev/mapper/luks-*
lrwxrwxrwx. 1 root root 7 Apr 25 23:40 /dev/mapper/luks-cba6febb-91cb-456e-afcf-0a16e89e4cae -> ../dm-4
lrwxrwxrwx. 1 root root 7 Apr 25 22:54 /dev/mapper/luks-e78b92c8-26a5-415b-9f95-c56aa9e511ca -> ../dm-2
[root@cmstorm home]# dmsetup info luks-cba6febb-91cb-456e-afcf-0a16e89e4cae
Name: luks-cba6febb-91cb-456e-afcf-0a16e89e4cae
State: ACTIVE
Read Ahead: 256
Tables present: LIVE
Open count: 0
Event number: 0
Major, minor: 253, 4
Number of targets: 1
UUID: CRYPT-LUKS1-cba6febb91cb456eafcf0a16e89e4cae-luks-cba6febb-91cb-456e-afcf-0a16e89e4cae
[root@cmstorm ~]# vim /etc/crypttab
luks-e78b92c8-26a5-415b-9f95-c56aa9e511ca UUID=e78b92c8-26a5-415b-9f95-c56aa9e511ca none
luks-cba6febb-91cb-456e-afcf-0a16e89e4cae UUID=cba6febb-91cb-456e-afcf-0a16e89e4cae none
Now you can use your newly encrypted device, in this case /dev/mapper/luks-cba6febb-91cb-456e-afcf-0a16e89e4cae, to create file system or use it with LVM for instance.
Check if a partition is already encrypted with LUKS
[root@cmstorm home]# cryptsetup isLuks /dev/sda1 && echo Yes
[root@cmstorm home]#
Fill the device with random data
# dd if=/dev/urandom of=/dev/sda1
or
# badblocks -c 10240 -s -w -t random -v /dev/sda1
Encrypt the partition
[root@cmstorm home]# cryptsetup luksFormat /dev/sda1
WARNING!
========
This will overwrite data on /dev/sda1 irrevocably.
Are you sure? (Type uppercase yes): YES
Enter LUKS passphrase:
Verify passphrase:
[root@cmstorm home]# cryptsetup isLuks /dev/sda1 && echo Yes
Yes
[root@cmstorm home]# cryptsetup luksDump /dev/sda1
LUKS header information for /dev/sda1
Version: 1
Cipher name: aes
Cipher mode: cbc-essiv:sha256
Hash spec: sha1
Payload offset: 4096
MK bits: 256
MK digest: b9 2d fd e6 d2 ab 1b 83 9c 4e 26 36 ba b7 a0 62 a9 49 b7 59
MK salt: 35 79 84 53 ce 26 0a 3c da 1a cc a0 c0 fc 4f 1f
c1 82 91 2e 3c df f2 44 63 e7 f2 b6 42 a6 11 3b
MK iterations: 72875
UUID: cba6febb-91cb-456e-afcf-0a16e89e4cae
Key Slot 0: ENABLED
Iterations: 291655
Salt: fd e6 dc 28 4f 68 ed 56 10 19 80 2c 74 33 1b 55
e9 8e 12 7c 08 be 24 0d 97 f5 f2 fd fb 21 65 01
Key material offset: 8
AF stripes: 4000
Key Slot 1: DISABLED
Key Slot 2: DISABLED
Key Slot 3: DISABLED
Key Slot 4: DISABLED
Key Slot 5: DISABLED
Key Slot 6: DISABLED
Key Slot 7: DISABLED
Open the encrypted device and create mapping
[root@cmstorm home]# cryptsetup luksUUID /dev/sda1
cba6febb-91cb-456e-afcf-0a16e89e4cae
[root@cmstorm home]# cryptsetup luksOpen /dev/sda1 luks-cba6febb-91cb-456e-afcf-0a16e89e4cae
Enter passphrase for /dev/sda1:
[root@cmstorm home]# ll /dev/mapper/luks-*
lrwxrwxrwx. 1 root root 7 Apr 25 23:40 /dev/mapper/luks-cba6febb-91cb-456e-afcf-0a16e89e4cae -> ../dm-4
lrwxrwxrwx. 1 root root 7 Apr 25 22:54 /dev/mapper/luks-e78b92c8-26a5-415b-9f95-c56aa9e511ca -> ../dm-2
[root@cmstorm home]# dmsetup info luks-cba6febb-91cb-456e-afcf-0a16e89e4cae
Name: luks-cba6febb-91cb-456e-afcf-0a16e89e4cae
State: ACTIVE
Read Ahead: 256
Tables present: LIVE
Open count: 0
Event number: 0
Major, minor: 253, 4
Number of targets: 1
UUID: CRYPT-LUKS1-cba6febb91cb456eafcf0a16e89e4cae-luks-cba6febb-91cb-456e-afcf-0a16e89e4cae
[root@cmstorm ~]# vim /etc/crypttab
luks-e78b92c8-26a5-415b-9f95-c56aa9e511ca UUID=e78b92c8-26a5-415b-9f95-c56aa9e511ca none
luks-cba6febb-91cb-456e-afcf-0a16e89e4cae UUID=cba6febb-91cb-456e-afcf-0a16e89e4cae none
Now you can use your newly encrypted device, in this case /dev/mapper/luks-cba6febb-91cb-456e-afcf-0a16e89e4cae, to create file system or use it with LVM for instance.
Parted : How to create partitions?
Important: This is not a definite guide. Use parted with caution and always have a backup before you modify anything. Improper use of parted may destroy all your data and I do not take any responsibility of that. You were warned.
Print available devices
[root@cmstorm home]# parted /dev/sda print devices
/dev/sda (2000GB) - we will use this disk
/dev/sdb (500GB)
/dev/sdc (250GB)
/dev/sdd (1000GB)
/dev/mapper/vg_home-home (250GB)
/dev/mapper/luks-e78b92c8-26a5-415b-9f95-c56aa9e511ca (250GB)
/dev/mapper/vg_root-root (373GB)
/dev/mapper/vg_root-swap (18.9GB)
Display free space on a disk
[root@cmstorm home]# parted /dev/sda print free
Model: ATA WDC WD2002FAEX-0 (scsi)
Disk /dev/sda: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
17.4kB 2000GB 2000GB Free Space
Create or change the label if needed
(parted) mklabel
New disk label type? - press Tab key twice here
aix amiga bsd dvh gpt loop mac msdos pc98 sun
New disk label type? gpt
Warning: The existing disk label on /dev/sda will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? Yes
(parted) print
Model: ATA WDC WD2002FAEX-0 (scsi)
Disk /dev/sda: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
Create new partition(s)
(parted) mkpart
Partition name? []? 1
File system type? [ext2]?
Start? 1
End? 50%
(parted) print
Model: ATA WDC WD2002FAEX-0 (scsi)
Disk /dev/sda: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 1000GB 1000GB ext4 1
(parted) mkpart
Partition name? []? 2
File system type? [ext2]?
Start? 50%
End? 100%
(parted) print
Model: ATA WDC WD2002FAEX-0 (scsi)
Disk /dev/sda: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 1000GB 1000GB ext4 1
2 1000GB 2000GB 1000GB 2
(parted) quit
Check partition alignment
[root@cmstorm home]# parted /dev/sda align-check
alignment type(min/opt) [optimal]/minimal? optimal
Partition number? 1
1 aligned
[root@cmstorm home]# parted /dev/sda align-check
alignment type(min/opt) [optimal]/minimal?
Partition number? 2
2 aligned
[root@cmstorm home]#
How to remove partition(s)
[root@cmstorm home]# parted /dev/sda
GNU Parted 3.0
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: ATA WDC WD2002FAEX-0 (scsi)
Disk /dev/sda: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 1000GB 1000GB ext4 1
2 1000GB 2000GB 1000GB 2
(parted) rm 2
(parted) rm 1
(parted) print
Model: ATA WDC WD2002FAEX-0 (scsi)
Disk /dev/sda: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
(parted) quit
Tip: fdisk (util-linux 2.21.2) does not support GPT.
[root@cmstorm home]# fdisk -l /dev/sda
WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.
Wednesday, April 17, 2013
Linux : iostat - storage performance
iostat - Report Central Processing Unit (CPU) statistics and input/output statistics for devices and partitions.
To see the statistics of your disk and partitions run the following iostat command:
# iostat -mx -h -p /dev/sdb 3
-m Display statistics in megabytes per second
-x Display extended statistics
-h Make the Device Utilization Report easier to read by a human
-p Displays statistics for block devices and all their partitions
that are used by the system
/dev/sdb - disk to be tested
3 The interval parameter specifies the amount of time in seconds between each report.
Example for two disks, sda and sdb including partitions:
# iostat -mx -h -d -p /dev/sda -p /dev/sdb 3
# whereis iostat
iostat: /bin/iostat /usr/bin/iostat /usr/share/man/man1/iostat.1.gz
Man page:
# man 1 iostat
To see the statistics of your disk and partitions run the following iostat command:
# iostat -mx -h -p /dev/sdb 3
-m Display statistics in megabytes per second
-x Display extended statistics
-h Make the Device Utilization Report easier to read by a human
-p Displays statistics for block devices and all their partitions
that are used by the system
/dev/sdb - disk to be tested
3 The interval parameter specifies the amount of time in seconds between each report.
Example for two disks, sda and sdb including partitions:
# iostat -mx -h -d -p /dev/sda -p /dev/sdb 3
# whereis iostat
iostat: /bin/iostat /usr/bin/iostat /usr/share/man/man1/iostat.1.gz
Man page:
# man 1 iostat
Linux : Bad blocks
badblocks - search a device for bad blocks
To check the mounted disk for bad blocks run the following command:
# badblocks -sv /dev/sdb
-s Show the progress of the scan
-v Verbose mode
/dev/sdb Disk to be tested
By default only a non-destructive read-only test is done. Check the man page for other options.
Man page:
# man 8 badblocks
To check the mounted disk for bad blocks run the following command:
# badblocks -sv /dev/sdb
-s Show the progress of the scan
-v Verbose mode
/dev/sdb Disk to be tested
By default only a non-destructive read-only test is done. Check the man page for other options.
Man page:
# man 8 badblocks
Friday, April 5, 2013
Fedora 17 : Conky in Gnome
1. Install Conky.
~]$ yum -y install conky
2. Create conkyrc file.
~]$ vi ~/.conkyrc
Make sure you use "own_window_type normal" and change eth0 to the name of your network interface.
3. Create runconky.sh startup script.
~]$ vi ~/.runconky.sh
4. Add Conky to Startup Programs
~]$ gnome-session-properties &
Click Add button:
Name: Conky
Command: ~/.runconky.sh
5. Log out and log in back.
--------------------------------------------------------------------------------
=== conkyrc ===
# .conkyrc
alignment top_right
gap_x 30
gap_y 50
background yes
border_width 1
cpu_avg_samples 2
default_color grey
default_outline_color black
default_shade_color lightgrey
draw_borders no
draw_graph_borders no
draw_outline no
draw_shades no
use_xft yes
xftalpha 0.75
xftfont DejaVu Sans:size=8
minimum_size 5 5
maximum_width 300
net_avg_samples 2
no_buffers yes
double_buffer yes
text_buffer_size 2048
out_to_console no
out_to_stderr no
extra_newline no
own_window yes
own_window_class Conky
#own_window_type desktop # makes it part of the desktop, GNOME hides this upon clicking desktop
own_window_type normal # makes it part of the desktop, but GNOME does not hide it
#own_window_type panel # cannot be hidden by other windows
#own_window_type dock # can be hidden by other windows, but cannot be aligned
own_window_argb_visual yes # added this in Fedora 19 to fix transparency issue
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
stippled_borders 0
uppercase no
use_spacer none
show_graph_scale no
show_graph_range no
imlib_cache_size 0 # Don't Cache Images
#update_interval 0.5
update_interval 1.0
#update_interval 2.0
#update_interval 3.0
#update_interval 4.0
#update_interval 5.0
#update_interval 10.0
#update_interval 15.0
#update_interval 30.0
#update_interval 60.0
TEXT
${color #ffcb48}${font openlogos:size=40}N${font DejaVu Sans:size=16} ${voffset -25}${offset -10} FEDORA 17
${voffset -10}${offset 45}$color${font}$sysname $kernel on $machine
${color #ffcb48}${font StyleBats:size=18}k ${font DejaVu Sans:size=16}SYSTEM ${hr 1}${font}
${color slate grey}Up:$color $uptime${goto 150}${cpugraph 50,150 4d8e00 A80000 -t}
${voffset -50}${color slate grey}CPU:$color $cpu%
${color slate grey}Processes:$color $running_processes/$processes
${color slate grey}Load:$color $loadavg
${color slate grey}CPU 0 $color${cpu cpu1}% ${cpubar cpu1}
${color slate grey}CPU 1 $color${cpu cpu2}% ${cpubar cpu2}
${color slate grey}CPU 2 $color${cpu cpu3}% ${cpubar cpu3}
${color slate grey}CPU 3 $color${cpu cpu4}% ${cpubar cpu4}
${color slate grey}Swap:$color $swap/$swapmax - $swapperc% ${swapbar 4}
${color slate grey}RAM:$color $mem/$memmax - $memperc% ${memgraph 10,128 4d8e00 A80000 -t}
${color #ffcb48}${font StyleBats:size=18}l ${font DejaVu Sans:size=14}Processes ${hr 1}${font}
${color slate grey}Name $alignr PID CPU% MEM%
$color${top name 1} $alignr$color ${top pid 1} ${top cpu 1}% ${top mem 1}%
$color${top name 2} $alignr$color ${top pid 2} ${top cpu 2}% ${top mem 2}%
$color${top name 3} $alignr$color ${top pid 3} ${top cpu 3}% ${top mem 3}%
$color${top name 4} $alignr$color ${top pid 4} ${top cpu 4}% ${top mem 4}%
$color${top name 5} $alignr$color ${top pid 5} ${top cpu 5}% ${top mem 5}%
$color${top name 6} $alignr$color ${top pid 6} ${top cpu 6}% ${top mem 6}%
$color${top name 7} $alignr$color ${top pid 7} ${top cpu 7}% ${top mem 7}%
$color${top name 8} $alignr$color ${top pid 8} ${top cpu 8}% ${top mem 8}%
$color${top name 9} $alignr$color ${top pid 9} ${top cpu 9}% ${top mem 9}%
${color #ffcb48}${font StyleBats:size=18}j ${font DejaVu Sans:size=14}File Systems ${hr 1}${font}
${color slate grey} / $color${fs_used}/${fs_size} ${alignr}${color slate grey}Used: $color${fs_used_perc /}% ${color slate grey}Free: $color${fs_free_perc /}%
${fs_bar 6}
${color slate grey} /home $color${fs_used /home}/${fs_size /home} ${alignr}${color slate grey}Used: $color${fs_used_perc /home}% ${color slate grey}Free: $color${fs_free_perc /home}%
${fs_bar 6 /home}
${color #ffcb48}${font StyleBats:size=18}2 ${font DejaVu Sans:size=14}Network ${hr 1}${font}
${color slate grey}Public: ${goto 41}$color${execpi 600 wget -q -O /dev/stdout http://checkip.dyndns.org/ | cut -d : -f 2- | cut -d \< -f -1} ${goto 150}${downspeedgraph eth0 30,150 4d8e00 A80000 -t}
${voffset -30}${color slate grey}IP: ${goto 45}$color${addr eth0}
${color slate grey}Down: ${goto 45}$color${downspeedf eth0} Kb/sec
${color slate grey}Up: ${goto 45}$color${upspeedf p5p1} Kb/sec${goto 150}${upspeedgraph eth0 30,150 4d8e00 A80000 -t}
${voffset -30}${color slate grey}Downloaded: $color${totaldown eth0}
${color slate grey}Uploaded: $color${totalup eth0}
=== runconky.sh ===
#!/bin/bash
sleep 10 && /usr/bin/conky -c /home/gescape/.conkyrc ;
Reference: http://conky.sourceforge.net/
~]$ yum -y install conky
2. Create conkyrc file.
~]$ vi ~/.conkyrc
Make sure you use "own_window_type normal" and change eth0 to the name of your network interface.
3. Create runconky.sh startup script.
~]$ vi ~/.runconky.sh
4. Add Conky to Startup Programs
~]$ gnome-session-properties &
Click Add button:
Name: Conky
Command: ~
5. Log out and log in back.
--------------------------------------------------------------------------------
=== conkyrc ===
# .conkyrc
alignment top_right
gap_x 30
gap_y 50
background yes
border_width 1
cpu_avg_samples 2
default_color grey
default_outline_color black
default_shade_color lightgrey
draw_borders no
draw_graph_borders no
draw_outline no
draw_shades no
use_xft yes
xftalpha 0.75
xftfont DejaVu Sans:size=8
minimum_size 5 5
maximum_width 300
net_avg_samples 2
no_buffers yes
double_buffer yes
text_buffer_size 2048
out_to_console no
out_to_stderr no
extra_newline no
own_window yes
own_window_class Conky
#own_window_type desktop # makes it part of the desktop, GNOME hides this upon clicking desktop
own_window_type normal # makes it part of the desktop, but GNOME does not hide it
#own_window_type panel # cannot be hidden by other windows
#own_window_type dock # can be hidden by other windows, but cannot be aligned
own_window_argb_visual yes # added this in Fedora 19 to fix transparency issue
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
stippled_borders 0
uppercase no
use_spacer none
show_graph_scale no
show_graph_range no
imlib_cache_size 0 # Don't Cache Images
#update_interval 0.5
update_interval 1.0
#update_interval 2.0
#update_interval 3.0
#update_interval 4.0
#update_interval 5.0
#update_interval 10.0
#update_interval 15.0
#update_interval 30.0
#update_interval 60.0
TEXT
${color #ffcb48}${font openlogos:size=40}N${font DejaVu Sans:size=16} ${voffset -25}${offset -10} FEDORA 17
${voffset -10}${offset 45}$color${font}$sysname $kernel on $machine
${color #ffcb48}${font StyleBats:size=18}k ${font DejaVu Sans:size=16}SYSTEM ${hr 1}${font}
${color slate grey}Up:$color $uptime${goto 150}${cpugraph 50,150 4d8e00 A80000 -t}
${voffset -50}${color slate grey}CPU:$color $cpu%
${color slate grey}Processes:$color $running_processes/$processes
${color slate grey}Load:$color $loadavg
${color slate grey}CPU 0 $color${cpu cpu1}% ${cpubar cpu1}
${color slate grey}CPU 1 $color${cpu cpu2}% ${cpubar cpu2}
${color slate grey}CPU 2 $color${cpu cpu3}% ${cpubar cpu3}
${color slate grey}CPU 3 $color${cpu cpu4}% ${cpubar cpu4}
${color slate grey}Swap:$color $swap/$swapmax - $swapperc% ${swapbar 4}
${color slate grey}RAM:$color $mem/$memmax - $memperc% ${memgraph 10,128 4d8e00 A80000 -t}
${color #ffcb48}${font StyleBats:size=18}l ${font DejaVu Sans:size=14}Processes ${hr 1}${font}
${color slate grey}Name $alignr PID CPU% MEM%
$color${top name 1} $alignr$color ${top pid 1} ${top cpu 1}% ${top mem 1}%
$color${top name 2} $alignr$color ${top pid 2} ${top cpu 2}% ${top mem 2}%
$color${top name 3} $alignr$color ${top pid 3} ${top cpu 3}% ${top mem 3}%
$color${top name 4} $alignr$color ${top pid 4} ${top cpu 4}% ${top mem 4}%
$color${top name 5} $alignr$color ${top pid 5} ${top cpu 5}% ${top mem 5}%
$color${top name 6} $alignr$color ${top pid 6} ${top cpu 6}% ${top mem 6}%
$color${top name 7} $alignr$color ${top pid 7} ${top cpu 7}% ${top mem 7}%
$color${top name 8} $alignr$color ${top pid 8} ${top cpu 8}% ${top mem 8}%
$color${top name 9} $alignr$color ${top pid 9} ${top cpu 9}% ${top mem 9}%
${color #ffcb48}${font StyleBats:size=18}j ${font DejaVu Sans:size=14}File Systems ${hr 1}${font}
${color slate grey} / $color${fs_used}/${fs_size} ${alignr}${color slate grey}Used: $color${fs_used_perc /}% ${color slate grey}Free: $color${fs_free_perc /}%
${fs_bar 6}
${color slate grey} /home $color${fs_used /home}/${fs_size /home} ${alignr}${color slate grey}Used: $color${fs_used_perc /home}% ${color slate grey}Free: $color${fs_free_perc /home}%
${fs_bar 6 /home}
${color #ffcb48}${font StyleBats:size=18}2 ${font DejaVu Sans:size=14}Network ${hr 1}${font}
${color slate grey}Public: ${goto 41}$color${execpi 600 wget -q -O /dev/stdout http://checkip.dyndns.org/ | cut -d : -f 2- | cut -d \< -f -1} ${goto 150}${downspeedgraph eth0 30,150 4d8e00 A80000 -t}
${voffset -30}${color slate grey}IP: ${goto 45}$color${addr eth0}
${color slate grey}Down: ${goto 45}$color${downspeedf eth0} Kb/sec
${color slate grey}Up: ${goto 45}$color${upspeedf p5p1} Kb/sec${goto 150}${upspeedgraph eth0 30,150 4d8e00 A80000 -t}
${voffset -30}${color slate grey}Downloaded: $color${totaldown eth0}
${color slate grey}Uploaded: $color${totalup eth0}
=== runconky.sh ===
#!/bin/bash
sleep 10 && /usr/bin/conky -c /home/gescape/.conkyrc ;
Reference: http://conky.sourceforge.net/
Subscribe to:
Posts (Atom)