Saturday, November 27, 2021

Linux: Small Font in Viber Running in Gnome

Edit hidden Bash profile file in your home directory:

$ vim ~/.profile

Add export QT_SCALE_FACTOR=1.25 to the end of the file.

Logout and login back.

Lunch Viber.

Sunday, July 7, 2019

Fedora 30: Set the default GRUB menu entry to the latest kernel after the upgrade or update.

When you upgrade Fedora 29 or earlier to Fedora release 30 (Thirty) or do the kernel update while already running Fedora 30 the default kernel in the GRUB menu might be set to the oldest installed kernel instead to the latest one as expected, especially when you have been upgrading Fedora from earlier releases.
To set the GRUB menu to the latest installed kernel simply open the terminal after the upgrade/update and run the following command as root:

# grub2-set-default 0
or
$ sudo grub2-set-default 0

Wednesday, April 24, 2019

Guitar: Fender® FUSE™ Mustang™ II v.2 Presets "Bypass"

This is the way I achieved the presets "bypass" to use Fender® Mustang™ II v.2 with a Zoom G5n multi-effects processor with its ultra-realistic amp/cabinet emulation.


Wednesday, March 22, 2017

Fedora 24: Recording with Ardour, QJackCtl and Zoom 2g.1u Guitar Effects Pedal.

I assume that you have Ardour (I have version 5.5.0-1), JACK, QJackCtl already installed and Zoom correctly connected to your computer via USB.

[GUITAR]---INPUT[ZOOM]---USB---[PC]PHONES---AUX[AMP]PHONES---d(-_-)b
                OUTPUT-------------------------INPUT

First launch QJackCtl and configure the JACK server. Do not start the server yet. Click Setup... button.


From Settings tab select Advanced tab.
Select as an Input Device and choose the hw:CODEC USB Audio CODEC.


Launch the Ardour and select the following settings for the new session and click Start button. 


Once the Ardour is started check if the JACK is running and you see the connections. If JACK is not running click the Start button.


Click the Connect button and then Expand All. You may need to click Refresh too.


Add a new track(s).



Right click on the track and select Inputs... and Outputs... to configure the connections respectively.
Repeat the same for all other tracks you added and the Master track.

Track(s)


Master:

You can also configure Inputs... and Outputs... in the Mixer. 
Click the Mixer button in Ardour main window on the toolbar.
Click the "Track Name" in the Mixer for each track and select Inputs... and Outputs... to configure them.




You can start recording now.

Note: Of course, it is a very basic configuration to just get you started. I guess, it should work with any USB audio interface really. If you want to learn more please see the reference below.

Reference:



Saturday, October 1, 2016

Fedora 24: invisible mouse cursor after login to VM running on KVM.

Issue: In Fedora 24 after login into the VM running on a local host in KVM the mouse cursor becomes invisible.

Environment: 
Host
    - Fedora 24
    - kernel 4.7.4-200.fc24.x86_64
    - virt-manager-1.4.0-3.fc24.noarch
    - virt-viewer-4.0-1.fc24.x86_64
    - qemu-kvm-2.6.1-1.fc24.x86_64
VM
    - SUSE Linux Enterprise Server 12 SP1
    - kernel 3.12.49-11-default
    - video QXL / Spice
    - gnome-shell-3.10.4-40.1.x86_64

Solution:
I found that changing the screen resolution to a different value resolves the issue and mouse cursor becomes visible again.
To automate this workaround I wrote the following simple script named chres.sh:

     #!/bin/bash
     # Change the resolution
     XRANDR=`which xrandr`
     SCREEN="Virtual-0"
     $XRANDR --output $SCREEN --mode 1280x720
     sleep 1
     $XRANDR --output $SCREEN --mode 1280x800
     exit

I then created the autostart folder in ~/.config/ and added chres.sh to it and made it executable.
Finally, I created the following file in ~/.config/autostart/ named chres.desktop:

     [Desktop Entry]
     Name=chres
     GenericName=Changing resolution
     Comment=To change the resolution in Gnome session 
     Exec=/home/username/.config/autostart/chres.sh
     Terminal=true
     Type=Application
     X-GNOME-Autostart-enabled=true

Now when I login to Gnome session the chres.sh runs automatically changing quickly the resolution and resolving the issue, so the mouse cursor is immediately visible and available. 
If you have the same issue, you may need to check if the xrandr is installed in the same path and what is your default screen.


I hope this will help.

Thursday, September 24, 2015

Fedora 22 : Moving from Gnome to KDE/Plasma

I decided to give it a try again on my Fedora 22 laptop, since I am happily using KDE/Plasma on my openSUSE desktop and in my personal opinion even though Gnome is now a great new and fresh desktop, I truly believe that it is far too heavy for its minimalistic look and approach and is missing some simple and quite common desktop features, for instance standard window buttons like minimize, maximized, etc. Also there are couple of nice features which you need to add as extensions and https://extensions.gnome.org/ is still showing "Beta" on the home page, for ages now. The desktop modification options are at their minimum. Simply it takes to much effort in my opinion to make default Gnome on Fedora to make it work and look the way you may want, at least for me. This is not good for a modern desktop these days, I believe. It gives me the feeling that Fedora (with Gnome) although open source seem to be very much like vendor locked, at least out of the box, do not get me wrong. KDE/Plasma on the other side, although also quite fresh and killed systray we knew for so long, still is much more flexible out of the box, I think.

My Fedora 22 is a long running laptop after several upgrades, changes, etc. I actually do not remember when I reinstalled it fresh last time. I have to say, fedup was doing a great job every time.

The way I did it.

First, I installed KDE Plasma Workspaces group.

# dnf group list
# dnf group install "KDE Plasma Workspaces"

I restarted the machine and I was presented with gdm. I selected KDE (obviously) and logged in. So far, so good.

Then I decided to change the gdm to sddm.

# dnf install sddm
# systemctl status gdm.service
# systemctl disable gdm.service
# systemctl enable sddm.service
# reboot

After a reboot I could not login anymore. Neither my user password, nor root password worked.

I logged in on the second console (Ctrl+Alt+F2) as root and checked /var/log/messages. I found the following entries:

Sep 24 00:14:35 xxx kernel: audit: type=2300 audit(1443050075.602:649): pid=6160 uid=0 auid=500 ses
=4 subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 msg='pam: default-context=unconfined_u:unconfined_r:unc
onfined_t:s0-s0:c0.c1023 selected-context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 exe="/
usr/libexec/sddm-helper" hostname=? addr=? terminal=:0 res=success'

Checking status of the sddm service also was returning some errors regarding PAM authentication problems and not being able to find the user.

I logged in on the second console as regular user , started X and changed the sddm settings from System Settings > Statup and Shutdown > Login Screen (SDDM). Rebooted the machine... and still the same problem and same errors.

I checked the /etc/sddm.conf only to find out that all the changes made in GUI were not saved there.
I manually then edited the file to look like this:

# cat /etc/sddm.conf
[Autologin]
Relogin=false
Session=
User=

[General]
NumLock=on
HaltCommand=
RebootCommand=

[Theme]
Current=breeze
CursorTheme=breeze_cursors

[Users]
MaximumUid=65000
MinimumUid=500

One of the main problems was that my user has the UID=500 and the default value for MinimumUid was 1000. Changing the value in GUI was not reflected in this config, so I changed it manually again.
After that I created a user's photo icon with the filename username.face.icon and format PNG image data, 62 x 63, 8-bit/color RGB, non-interlaced. I then copied it to /usr/share/sddm/faces/.
Finally, I restarted sddm service, logged out from the second console and restarted the laptop.
Now I was presented with my local user, selected Plasma and logged in without problem.

Maybe this will help you too. ;-)

P.S.
I did not remove Gnome. Why not to switch from time to time and see what is going on there? The same like with different distros. There is no better or worse, there is only different taste. I like blueberries, you like pears. ;-)

Sunday, February 22, 2015

Fedora 21 : LCD screen backlight brightness on Acer Aspire 5742 issue

This is an update on the ongoing issue with a backlight in Fedora. I first experienced it in Fedora 15, although I suppose it is a much longer story.
Basically, backlight works, then update, stops working, then update works again, sometimes it needs a little tuning, sometimes not. Simply it is a problem Fedora (or upstream kernel) developers struggle for a very long time and cannot fix it. However, in Windows it works for years without a single issue.
I have a friend, who is a fantastic Linux expert and now I understand why he always says "Linux, on server absolutely yes, on workstation - no way." 

And he is the update for Fedora 21 on  Acer Aspire 5742.

acpi_backlight=vendor option does not work, even though it pretty much, nearly always was a good fix.
video.use_native_backlight=1 does not work at all.
pcie_aspm=force acpi_osi=Linux acpi_backlight=vendor partially works, it changes the brightness of the screen while using Fn keys, however the slider in Gnome settings and extension does not have effect at all.

Let's see what the next update will bring. ;-)

Friday, February 13, 2015

KVM : How to convert disk format

1. Remove the disk from the VM.


2. Convert the disk format, for example from raw to qcow2.

# qemu-img convert -p -O qcow2 FedoraWS.img FedoraWS.qcow2

3. Add a "new-format" disk to the VM.








Thursday, February 12, 2015

OpenSUSE 13.2 : How to install Revelation password manager.

1. Go to:
http://software.opensuse.org/download.html?project=security%3Apasswordmanagement&package=revelation

2. Select openSUSE 13.2.


3. Open with YaST, click OK.


4. Add repository, click Next.


5. Select revelation, click Next.


6. Click Next then OK and confirm root's password.


7. Install the following packages.

# zypper in python-pycrypto python3-pycrypto python-cracklib


8. Lunch Revelation.



Wednesday, July 31, 2013

Gnome Shell Theme Customization

# 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;

#panel {
background-color: rgba(0,0,0,0.5); # Panel background and transparency
font-weight: bold;
height: 1.8em; # Panel height


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

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.




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

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


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/