jump to navigation

CentOS 7 – Installing 2 x 4TB Software RAID LVM GPT BIOSBOOT 20 August 2017

Posted by Maulvi Bakar in : Linux,System,Work , add a comment

Recently, I have an interesting challenge – Installing CentOS 7 on a physical server with 2 x 4TB HDDs!  :-

Anytime you’re playing HDDs larger than 2TBs, you’ll need GPT and  BIOSBOOT is needed. Unless you have deep pockets to pay for hardware RAID, which can simplify your configuration, the poor man’s software RAIID is the way to go.  The catch is that you have to configure almost every aspect of the system with it.

On hardware RAID, once configured in the background, the OS will see only a single HDD Volume for which the OS will be installed onto.  The software RAID depends on the OS. The OS will see all the HDDs and will have to consider them all before Software RAID can be configured.

GPT BIOSBOOT partitions does not work on Software RAID.

It has to be installed in a standard partition – eg. /dev/sda1 – 1MB Size

Consider this scenario – 2 x HDDs, the first HDD will have the following –

/dev/sda1 – BIOSBOOT
/dev/sda2 – MD0 – /boot
/dev/sda3 – MD1 – LVM – swap, /

/dev/sdb1 – MD0 – /boot
/dev/sdb2 – MD1 – LVM – swap, /

Because, the above scenario is what the CentOS 7 GUI Installer allows you to configure.  The obvious solution to this is to have another BIOSBOOT partition on /dev/sdb but the GUI Installer logic (dessign flaw?) won’t allow you to do so.

Obvious weakness will be – what if /dev/sda fails and since only /dev/sdb exists in the RAID Array, without a BIOSBOOT partition, the system will not be bootable.

To overcome this, you’ll need to force the system into having a BIOSBOOT partitions on all HDDs, to ensure the system will bootable, regardless which device go missing. Consider the following –

/dev/sda1 – BIOSBOOT
/dev/sda2 – MD0 – /boot
/dev/sda3 – MD1 – LVM – swap, /

/dev/sdb1 – BIOSBOOT
/dev/sdb2 – MD0 – /boot
/dev/sdb3 – MD1 – LVM – swap, /

To achieve the above ideal layout, you will need to do the following –

  1. Boot from CentOS 7/RHEL 7 Installer
  2. Prep your installation – Date & Time Timezone, Network & Hostname, etc.
  3. Select Installation Detination
  4. Ensure both both disks are selected and Other Storage Options – “I will configure partitioning” radio button is selected
  5. Temporarily go to shell prompt by pressing -> Ctrl + Alt + F2
  6. Execute “gdisk /dev/sda”. I GPT is not available, create it.
  7. Create the BIOSBOOT partition on /dev/sda
  8. n (new) -> Partition = 1 -> Start = Enter -> End = +1M ->Type: EF02 -> w (write)
  9. Repeat the last three steps for /dev/sdb
  10. Once done, return back to GUI Installer by pressing -> Ctrl + Alt + F6
  11. Click the refresh button – Observe that the two Bios Boot partitions will be under ‘Unknown’
  12. You can now proceed with the rest of the partition configuration –
  13. Create the /boot RAID Partition, once created, you will notice one of the BIOSBOOT partition create earlier will appearon the main System partitions list.
  14. Create the swap and “/” LVM partitions, click the “modify” button to RAID it.
  15. Click Done.

Your installation should proceed and BIOSBOOT partitions will be on both disks!

BASH Shortcuts 2 October 2013

Posted by Maulvi Bakar in : Linux,Work , add a comment

These are the shortcuts for Bash Commands. Your mileage may vary..

Ctrl-a Move to the start of the line.
Ctrl-e Move to the end of the line.
Ctrl-b Move back one character.
Alt-b Move back one word.
Ctrl-f Move forward one character.
Alt-f Move forward one word.
Ctrl-] x Where x is any character, moves the cursor forward to the next occurance of x.
Alt-Ctrl-] x Where x is any character, moves the cursor backwards to the previous occurance of x.
Ctrl-u Delete from the cursor to the beginning of the line.
Ctrl-k Delete from the cursor to the end of the line.
Ctrl-w Delete from the cursor to the start of the word.
Esc-Del Delete previous word (may not work, instead try Esc followed by Backspace)
Ctrl-y Pastes text from the clipboard.
Ctrl-l Clear the screen leaving the current line at the top of the screen.
Ctrl-x Ctrl-u Undo the last changes. Ctrl-_ does the same
Alt-r Undo all changes to the line.
Alt-Ctrl-e Expand command line.
Ctrl-r Incremental reverse search of history.
Alt-p Non-incremental reverse search of history.
!! Execute last command in history
!abc Execute last command in history beginning with abc
!abc:p Print last command in history beginning with abc
!n Execute nth command in history
!$ Last argument of last command
!^ First argument of last command
^abc^xyz Replace first occurance of abc with xyz in last command and execute it


dracut Warning: No root device “block:/dev/disk/by-label/root” found – CentOS 6 19 May 2013

Posted by Maulvi Bakar in : Linux,System,Work , add a comment

I’ve been on GE-mode for the past few months. In effort to maintain stability, I resisted upgrading the KVM-host machine to the latest kernel. Sorry guys, I’m still on CentOS, not on OEL, so no Ksplice!

To cut story short, the kernel upgrades results in the infamous CentOS/RHEL depmod bug! –

dracut Warning: No root device "block:/dev/disk/by-label/root" found
dracut Warning: Boot has failed. To debug this issue add "rdshell" to the kernel command line.
dracut Warning: Signal caught!
dracut Warning: Boot has failed. To debug this issue add "rdshell" to the kernel command line.
Kernel panic - not syncing: Attempted to kill init!
Pid: 1, comm: init Not tainted 2.6.32-358.6.2.el6.x86_64 #1
Call Trace:
[] ? panic+0x78/0x143
[] ? do_exit+0x852/0x860
[] ? fput+0x25/0x30
[] ? do_group_exit+0x58/0xd0
[] ? sys_exit_group+0x17/0x20
[] ? system_call_fastpath+0x16/0x1b

The system kernel-panics!

Even the built-in kernel fallback options in GRUB did not activate!!

Canvassing the net suggests that the kernel modules did not install properly and the solution is to install manually via the commands below –

# depmod -ae -F /boot/System.map-2.6.32-358.6.2.el6.x86_64 2.6.32-358.6.2.el6.x86_64
# dracut --force '' 2.6.32-358.6.2.el6.x86_64

I tried that via CentOS Rescue Mode and ‘chroot /mnt/sysimage’. This too was fun, KVM Console ISO Image redirection from your local PC to a site on the far side of the galaxy is something you should only attempt on a high-bandwidth! UniFi is crap!

Luckily the KVM Console supports mounting ISO Image from a SAMBA Share. A small tiny low-end-box serves the purpose nicely and being much closer in peering to the main KVM-host site makes it even better!

Unfortunately, that doesn’t seem to work for me.

But what does work – instead of ‘yum update’, I did a ‘yum localinstall’. Downloaded the kernel and kernel-devel RPMs onto the local disk and installed it after removing the broken kernel before that.

That seems to do the trick!

Hope it solves someone else issue with this.

God willing!

Loading US Keyboard Map QWERTY on Linux 14 March 2011

Posted by Maulvi Bakar in : Linux,Work , 1 comment so far

Sometimes, when you’re supporting machines located on various parts of the world, you’ll encounter machines with funny keyboard arrangements.

This is normal!

Different parts of Europe and Canada uses different keyboard language layout. You’re using a machine with US Keyboard layout to access these machines and to change the layout to it, issue the following commands –

/bin/loadkeys /usr/share/kbd/keymaps/i386/qwerty/us.map.gz

Inside the same directory lists a bunch of other commonly/un-commonly used keyboard keymaps. Your mileage vary depending were you’re located from and what type of keyboard you’re using.


Solaris Ping Results 17 February 2011

Posted by Maulvi Bakar in : Unix,Work , add a comment

Ever tried to ping a host on a Solaris machine?

$ ping pong

pong is alive

You’ll get a plain ‘is alive’ results. If you need packets received and timing information, you have to add the option -s like thus –

user@tennis:/usr/sbin > ping -s pong

PING pong: 56 data bytes
64 bytes from pong (x.x.x.x): icmp_seq=0. time=0. ms
64 bytes from pong (x.x.x.x): icmp_seq=1. time=0. ms
64 bytes from pong (x.x.x.x): icmp_seq=2. time=2. ms
64 bytes from pong (x.x.x.x): icmp_seq=3. time=0. ms
64 bytes from pong (x.x.x.x): icmp_seq=4. time=0. ms
64 bytes from pong (x.x.x.x): icmp_seq=5. time=0. ms

----pong PING Statistics----
6 packets transmitted, 6 packets received, 0% packet loss
round-trip (ms) min/avg/max = 0/0/2

Funny Solaris trying not to conform with the rest of the *NIX community.


Customizing the Bash Prompt 19 December 2010

Posted by Maulvi Bakar in : Linux,Unix,Work , add a comment

If you’re on Linux, most of the time the current existing bash prompt is fine. Other types of UNIX, in my case is Solaris, is somewhat spartan in appearance. You’ll either get a boring ‘$’ or ‘#’ or simply a display of version.

The table below are the various options available –

Personally, I just wanted to duplicate the bash prompt on Linux into Solaris. All I did was thus in the “/etc/profile” –

export PS1
PS1='[\u@\h:\w]\$ '

Remember to use single quotes ” ‘ ” rather than the double quotes. Otherwise the “\$” will not work.


Howto: Disable GUI Desktop on Solaris 10

Posted by Maulvi Bakar in : Unix,Work , add a comment

My life seems to be centered around *NIX. After many false start, I am about to embark on a serious Solaris journey.

*NIX politics aside. I’ve formed judgment already, but I reserve publishing it at the moment. For the time being, enough said – it is a pure workplace choice.

# date;uname -a;uptime
Sun Dec 19 14:27:32 MYT 2010
SunOS solaris 5.10 Generic_142910-17 i86pc i386 i86pc
2:27pm up 25 min(s), 1 user, load average: 0.01, 0.11, 1.05

By default, Oracle Solaris 10 will start with Gnome/CDE GUI interface upon start-up. To disable GUI, especially if you intend to run a headless server, do this –

# /usr/dt/bin/dtconfig -d

To enable it again, simply –

# /usr/dt/bin/dtconfig -e


HPUX Breaking Mirror and Extending LVM 2 June 2009

Posted by Maulvi Bakar in : Unix,Work , add a comment

I’m learning new things nowadays..  Particularly HPUX.  Not really my cup of tea since it not open-source but interesting enough though.

We had one machine with mirrored harddisks with one being faulty that needs removal.

Break mirror procedure..

1. Remove the mirror on the Logical Volume affected within the Volume Group
lvreduce -m 0 /dev/vg01/lvol1 /dev/dsk/c2t0d0
lvreduce -m 0 /dev/vg01/lvol2 /dev/dsk/c2t0d0

2. Now remove the Volume Group from the Physical Volume that is targeted for removal
vgreduce /dev/vg01 /dev/dsk/c2t0d0

3. Finally remove the Physical Volume from the Physical Disk
pvremove /dev/rdsk/c2t0d0
Please note the ‘r’.. ‘r’ stands for physical disk, while the one without is the physical volume..

Restore mirror procedure…

1. First, let’s verify things
ioscan -funC disk
pvdisplay /dev/dsk/c1t0d0        # get lvm info of existing disk.
pvdisplay /dev/dsk/c2t0d0        # get err, no lvm def on it, raw disk.

2. Now we create the Physical Volume within the Physical Disk and extend the Volume Group onto it.
pvcreate /dev/rdsk/c2t0d0        # add physical disk to be used by LVM
vgextend /dev/vg01 /dev/dsk/c2t0d0    # incorporate new disk to existing vg00

2a. If you’re recreating a bootable disk, the commands below must be used instead –

pvcreate -B /dev/rdsk/c2t0d0        # add physical disk to be used by LVM and make it bootable
vgextend /dev/vg01 /dev/dsk/c2t0d0    # incorporate new disk to existing vg00
mkboot -a "hpux -lq /stand/vmunix" /dev/dsk/c2t0d0     # install the bootloader

3. Check and verify!
strings /etc/lvmtab            # see new disk used by lvm

4. The next steps will actually perform the mirror, and it will fail if -m mirroring option is not activated with valid license
lvextend -m 1 /dev/vg01/lvol1 /dev/dsk/c2t0d0    # add mirror for lvol1
lvextend -m 1 /dev/vg01/lvol2 /dev/dsk/c2t0d0    # add mirror for lvol2


Changing user’s file ownership across the board 25 December 2008

Posted by Maulvi Bakar in : Linux,Unix,Work , add a comment

The guys from the promised database lands had their systems acting funny.  After investigation, they found out that, their files was having the wrong group ownership.

There’s a total of 70,000 files involved.  Promised lands or not, manually changing 70,000 files (and folders) is not a good prospect.  Well, I could go through the individual sub-folders but I would need to work from the last in-depth sub-folders and work my way out.  Even that does not guarantee accuracy, since there might be sub-folders with multiple owners which I’m not suppose to touch.  When that happen, then I have to go through it manually looking at each files and folders individually – not good.

There has to be a short-cut.

I know I can locate all the files that needs to be changed it’s ownership by using the following commands –
find ./ -user someuser -group wronggroup -print

It’ll list all the relevant files and sub-folders. At first, maybe I’ll output it into a file, all the results. Manipulate the file into an executable. Append each lines with a “chgrp correctgroup” and have something like – “chgrp correctgroup ./to/the/path/of/the/file”.

I am smart, hey! 😉

Let’s prove that I can be smarter  😛

Vanity and pride are different things, though the words are often used synonymously. A person may be proud without being vain. Pride relates more to our opinion of ourselves; vanity, to what we would have others think of us.

Jane Austen

No, I’m just trying to figure out the best way of doing things.

“xargs -t <commands>”

xargs is a command of Unix and most Unix-like operating systems. It is useful when one wants to pass a large number of arguments to a command. Arbitrarily long lists of parameters can't be passed to a command, so xargs will break the list of arguments into sublists small enough to be acceptable.

xargs - build and execute command lines from standard input

The “-t” is for the verbose option. It’ll spew out the output of the commands being executed.

Basically, every time the output of the earlier “find”, it’ll append the extra commands specified and have it executed. Voila, no need to make a separate executable. My solution is thus –

find ./ -user someuser -group wronggroup -print | xargs -t chgrp correctgroup

Happy 4th Anniversary to myself  😉

Merry Christmas everyone!


Linux sparse file in /var/log/lastlog using RHEL3 19 November 2008

Posted by Maulvi Bakar in : Linux,Work , add a comment

The guys in the promised backup lands had their heads scratching.  Their backups seems to bloat an extra 1.2TB in size!  The culprit seems to be the


Lastlog is sparse file which contains unallocated blocks or “empty space” and it does not actually take up filesystem space.  Simple test like thus will have a very straightforward results –

$ du -H /var/log/lastlog
156kB   /var/log/lastlog

Furthermore, “lastlog” is a file that almost never grow anyway. A common issue apparently.

Usually it is suggested that either the file be excluded from the backup excercise or, if policy-wise not possible, then the backup application to be configured to handle the specific sparse file, in this case “lastlog”.

Sparse files can confuse some backup software. Usually tools like GNU tar requires the use of the -S parameter to fix it. If you are using some other software, consult the backup software’s manuals for options on how to deal with sparse files.