Friday, August 25, 2017

Add a new virtual hard disk to your Linux VM

1. log in as root
2. run this command and make note of the sdx entries
[root@localhost ~]# ls -l /dev/sd*
brw-r----- 1 root disk 8,  0 Aug 25 03:46 /dev/sda
brw-r----- 1 root disk 8,  1 Aug 25 10:46 /dev/sda1
brw-r----- 1 root disk 8,  2 Aug 25 03:46 /dev/sda2
brw-r----- 1 root disk 8,  3 Aug 25 03:46 /dev/sda3
brw-r----- 1 root disk 8,  4 Aug 25 10:46 /dev/sda4

3.  Add a new virtual hard disk to your VM from VMware Workstation GUI

4. run this command and you'll see the new entry for your newly added disk
[root@localhost ~]# ls -l /dev/sd*
brw-r----- 1 root disk 8,  0 Aug 25 03:46 /dev/sda
brw-r----- 1 root disk 8,  1 Aug 25 10:46 /dev/sda1
brw-r----- 1 root disk 8,  2 Aug 25 03:46 /dev/sda2
brw-r----- 1 root disk 8,  3 Aug 25 03:46 /dev/sda3
brw-r----- 1 root disk 8,  4 Aug 25 10:46 /dev/sda4
brw-r----- 1 root disk 8, 16 Aug 25 03:46 /dev/sdb

5. check your current file system type, it is ext3 for /
[root@localhost ~]# mount |grep ^/dev
/dev/sda4 on / type ext3 (rw)
/dev/sda2 on /tmp type ext2 (rw)
/dev/sda1 on /boot type ext3 (rw)

6. Check disk size and partition table with fdisk
[root@localhost ~]# fdisk -l

Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          65      522081   83  Linux
/dev/sda2              66         326     2096482+  83  Linux
/dev/sda3             327         587     2096482+  82  Linux swap / Solaris
/dev/sda4             588        2610    16249747+  83  Linux

Disk /dev/sdb: 26.8 GB, 26843545600 bytes
255 heads, 63 sectors/track, 3263 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn't contain a valid partition table

7. create an ext3 file system on the whole new disk
$ mkfs -t ext3 /dev/sdb


8. make directory as mount point
$ mkdir /bld

9. edit fstab for a permanent mount
/dev/sdb                 /bld                   ext3    defaults        0 0

10. reboot your VM



RCA: data type is incorrect

QA reported one issue during regression test. He added one Hbase backup configuration via GUI but the backup operation failed. HDFS backup is OK.

Looking into this issue, I found the data type is saved as "HDFS" in the configuration file which should be "HBASE" in the URL. It narrows down the problem.

Looking back to a recent checkin by a team member, I found this:
184:                   if ($scope.editdatamodel.bkCfg.type == "hbase") {
185:                        value = "/" + value;
186:                        basedir.replace("hdfs://", "hbase://");
187:                    }
Look at line 186. Yes, that's the root cause.  The javascript function 'replace' does not search and replace in place. It returns a NEW string.
https://www.w3schools.com/jsref/jsref_replace.asp

Solution:
    basedir = basedir.replace("hdfs://", "hbase://");