Tuesday, April 21, 2015

Creating A Partition Size Larger Than 2TB In Ubuntu Server

                                    Normally we cannot create a Linux partition larger than 2 TB using the fdisk command. The fdisk won't create partitions larger than 2 TB.
                                    To solve this problem use GNU parted command with GPT. It supports Intel EFI/GPT partition tables. Partition Table (GPT) is a standard for the layout of the partition table on a physical hard disk. It is a part of the Extensible Firmware Interface (EFI) standard proposed by Intel as a replacement for the outdated PC BIOS, one of the few remaining relics of the original IBM PC. EFI uses GPT where BIOS uses a Master Boot Record (MBR).
                                     Also note that booting from a GPT volume requires support in your BIOS / firmware. This is not supported on non-EFI platforms.
           Legacy BIOS mode = MBR partition required
           UEFI BIOS mode = GPT partition required for Windows (some Linux versions support GPT boot under legacy BIOS with hybrid MBR)
                                    A master boot record (MBR) is a special type of boot sector holds the information on how the logical partitions, containing file systems, are organized on that medium.This MBR code is usually referred to as a boot loader.
                                  The organization of the partition table in the MBR limits the maximum addressable storage space of a disk to 2 TiB (232 × 512 bytes).Therefore, the MBR-based partitioning scheme is in the process of being superseded by the GUID Partition Table (GPT) scheme in new computers. A GPT can coexist with an MBR in order to provide some limited form of backward compatibility for older systems.
1. Find Out Hard Disks Specification :-
root@ubuntu:~# lshw -class disk
 *-disk:0
      description: SCSI Disk
      physical id: 0.0.0
      bus info: scsi@32:0.0.0
      logical name: /dev/sda
      size: 20GiB (21GB)
      capabilities: partitioned partitioned:dos
      configuration: sectorsize=512 signature=000afad3
 *-disk:1
      description: SCSI Disk
      physical id: 0.1.0
      bus info: scsi@32:0.1.0
      logical name: /dev/sdb
      size: 3000GiB (3221GB)
      configuration: sectorsize=512
2. Find Out Newly added HDD detailed Information
root@ubuntu:~# fdisk -l /dev/sdb
Disk /dev/sdb: 3221.2 GB, 3221225472000 bytes
255 heads, 63 sectors/track, 391625 cylinders, total 6291456000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/sdb doesn't contain a valid partition table
Partition And Format HDD - 3TB gpart File System
1 . Start GNU parted
root@ubuntu:~# parted /dev/sdb
GNU Parted 2.3
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)
2 . Creates a new GPT disk label - Partition table
(parted) mklabel gpt
(parted)
3 . Set the Default unit to TB
(parted) unit TB
4 . Create a 3TB Partition Size
(parted) mkpart primary 0 0
OR
(parted) mkpart primary 0.00TB 3.00TB
5 . Print the Current Partitions
(parted) print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 3.22TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number  Start   End     Size    File system  Name     Flags
1      0.00TB  3.22TB  3.22TB               primary
6 . Quit and save the changes
(parted) quit
Information: You may need to update /etc/fstab
7. Check the HDD Information on partitioning
root@ubuntu:~# fdisk -l /dev/sdb
WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.
Disk /dev/sdb: 3221.2 GB, 3221225472000 bytes
255 heads, 63 sectors/track, 391625 cylinders, total 6291456000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1  4294967295  2147483647+  ee  GPT
7 . Format the HDD Partition with valid file system
root@ubuntu:~# mkfs.ext3 /dev/sdb1
OR
root@ubuntu:~# mkfs.ext4 /dev/sdb1
8 . Mount the HDD Partition into path /ictops
root@ubuntu:~# mkdir /ictops
root@ubuntu:~# mount /dev/sdb1 /ictops
9 . List Disk partition Information
root@ubuntu:~# df -H
Filesystem                   Size  Used Avail Use% Mounted on
/dev/mapper/ubuntu--vg-root   18G  1.2G   16G   7% /
none                         4.0K     0  4.0K   0% /sys/fs/cgroup
udev                         983M  4.0K  983M   1% /dev
tmpfs                        199M  612K  199M   1% /run
none                         5.0M     0  5.0M   0% /run/lock
none                         994M     0  994M   0% /run/shm
none                         100M     0  100M   0% /run/user
/dev/sda1                    236M   37M  188M  17% /boot
/dev/sdb1                    2.9T   72M  2.8T   1% /ictops

Thursday, April 16, 2015

Disable Strong Password Enforcement And Password Aging

                                          By default Microsoft Windows Server 2012 enforces users in the Administrators group to use strong passwords. Home users often just want to create their own passwords or leave them blank.
      1. Open Start ---> Administrative Tools ---> Local Security Policy ---> Account Policies
                   ---> Password Policy.
       2. In the right pane of Password Policy double click Password must meet complexity requirements   
            and set it to Disabled.
For enabling the Password never expire :-
          Open the Maximum password age policy and set set the value to 0. Click OK to apply the change.

Thursday, March 19, 2015

Cloning a VM Using VMware vSphere Client

                VMware vSphere is the most robust virtualization solution. Cloning a Virtual Machine in ESxi 5.x is a feature of vCenter server. Out of the box vSphere free edition hypervisor does not support cloning. But there is an alternative way to clone a VM.
  1. First connect to the ESXi using the vSphere client and power off the source VM.
  2. In vSphere client User Interface.Select the Configuration tab and Storage settings on the left menu. The Datastores list will come up on the right pane.
vSphere Datastores
     3. Right click on the datastore of the source VM and select Browse.
     4. Right click on the root folder on the left tree and Create a new folder.
     5. Select the source folder of the VM,which one we want to clone
     6  Copy the configuration file (.vmx) and the virtual disk file (.vmdk) Copying the files
 7. Paste the copied files into the destination folder,new folder
 8. In the destination folder select .vmx file and Add to Inventory.
 9. Enter the name of the cloned VM and finish the wizard.

Clone A VMware’s VM Without vCenter in ESXi 5.x-Using VMKFS

                                           I herewith show the procedure by cloning a VM Server/snapshot of a VM.We have already option for taking Snapshots of a VM in VSphere client.
For taking snapshot via VSphere client :- Right click the vVM ---> Make a snapshot
For taking Clone follow the steps
  1. Shutdown the VM otherwise the files will be locked.
  2. Connect the ESXi host via Putty and Browse the Datastore and check the VM Server location
#cd /vmfs/volumes/datstore name
     3.   List the items in the location
/vmfs/volumes/50e7090a-87ed9a0d-9b18-0026b95833b7#ls
     4.   Enter in to the location, which is allocated for the VM and list the items
/vmfs/volumes/50e7090a-87ed9a0d-9b18-0026b95833b7/SVR-1#ls
                                       As you can see now, there are more than one vmdk disk files, the flat vmdk, the delta vmdk and the vmdk descriptor file (the Xp3-000001.vmdk file in our example), along with the memory snapshot and various control and log files.
    For taking Clone Via vmkfstool command line Syntax :-
vmkfstools -i source_path destination_path -d disk_format -a adapter_type
If you didn’t have a snapshot, the source file would be the vmdk descriptor file of your vm
     5.   Create the destination folder in datastore folder
/vmfs/volumes/50e7090a-87ed9a0d-9b18-0026b95833b7/SVR-1 # mkdir SVR-2
     6.   Clone the disk file - In the case of Snapshot
vmkfstools -i /vmfs/volumes/220/SVR-1/vmsvr-1-000001.vmdk /vmfs/volumes/220/SVR-2/vmsvr-2.vmdk -d thin
     7.   Clone the disk file - No snapshot-take direct machine clone
vmkfstools -i /vmfs/volumes/220/SVR-1/vmsvr-1.vmdk /vmfs/volumes/220/SVR-2/vmsvr-2.vmdk -d thin
    8. Create a new vm and force the use of an existing disk file via VSphere client
Eg:-
Based i have a VM machine named “vmsvr-1” located in datastore.Datastore name is 220
Here i have clone my vmsvr-1 machine to a new vmsvr-2 VM and loaded into SVR-2 folder
  1. Login into the ESXi host and check the item in machine placed location                                    
                      #cd /vmfs/volumes/220/
                     /vmfs/volumes/50e7090a-87ed9a0d-9b18-0026b95833b7/SVR-1#ls
vmsvr-1-flat.vmdk  vmware-11.log
vmsvr-1.nvram      vmware-12.log
vmsvr-1.vmdk       vmware-13.log
vmsvr-1.vmsd       vmware-8.log
vmsvr-1.vmx        vmware-9.log
vmsvr-1.vmxf       vmware.log
vmware-10.log
  1. Clone the disk file - No snapshot-take direct machine clone
vmkfstools -i /vmfs/volumes/220/SVR-1/vmsvr-1.vmdk /vmfs/volumes/220/SVR-2/vmsvr-2.vmdk -d thin
After you enter the above command it shows a message to start the cloning process
Destination disk format: VMFS thin-provisioned
Cloning disk '/vmfs/volumes/220/SVR-1/vmsvr-1.vmdk'...
Clone: 10% done.
Clone: 100% done.
  1. Check the SVR-2 folder location after the cloning process
                    /vmfs/volumes/50e7090a-87ed9a0d-9b18-0026b95833b7/SVR-2 #ls
vmsvr2-flat.vmdk  vmsvr2.vmdk
  1. Create a new vm and force the use of an existing disk file (vmsvr-2.vmdk) via VSphere client

Wednesday, March 4, 2015

Run Tomcat 6/7 As tomcat Or Any Other User

                                      The default user and group are configured in /etc/default/tomcat.The file is format is show below
# Run Tomcat as this user ID. Not setting this or leaving it blank will use the
# default of tomcat7.
TOMCAT7_USER=tomcat7
# Run Tomcat as this group ID. Not setting this or leaving it blank will use
# the default of tomcat7.
TOMCAT7_GROUP=tomcat7
For Changing User Default User And Group In Tomcat:-
  1. Stop the tomcat service
  2. Editing the file /etc/default/tomcat7.Change the user and group in thi file
              (Add new user name instead of tomcat7)
  1. Change ownership of the folder /var/log/tomcat7 and /var/lib/tomcat7/webapps
            and all of it's files.
sudo chown -R newuser:newgroup /var/log/tomcat7
sudo chown -R newuser:newgroup /var/lib/tomcat7/webapps
sudo chown -R newuser:newgroup /var/log/tomcat7
     4. Optional :- Change ownership of the working folder
sudo chown newuser:newgroup /var/cache/tomcat7
sudo chown -R newuser:newgroup /var/cache/tomcat7/Catalina
     5. Make config files readable. Here you have two options:
Either add you new user to the tomcat7 group by:
sudo usermod -a -G tomcat7 newuser
          OR  change ownership of the config files:
sudo chown -R :newgroup /var/lib/tomcat7/conf/*
     6. Restarted the Server and Started the tomcat service

Monday, March 2, 2015

Command Line / Batch Script For Finding System Informations

For Username :-  whoami
For System Name :- hostname
For Computer Manufacturer :- systeminfo | findstr /c:"System Manufacturer"
For Computer Model :- systeminfo | findstr /c:"System Model"
       Make Batch File using With the above command
  1. Create a text file and saved as .bat extension
  2. Updated the text with the following command
whoami
hostname
systeminfo | findstr /c:"System Manufacturer"
systeminfo | findstr /c:"System Model"
pause

Sunday, March 1, 2015

Convert FAT32 To NTFS File System Without Losing Data

                                     Before you convert a Disk Drive from FAT32 File system to NTFS, you need to know the importance of the NTFS file system.NTFS file system has many advantages as compared to FAT File System below are the some listed advantage using NTFS.
  1. Allows indexing which improves file searching fast
  2. Better security – file encryption not available in Fat32
  3. Supports user's quota option
  4. File compression to save disk space on Hard Disk
  5. Supports larger files than FAT
                                          Once you convert a FAT32 partition to NTFS, you cannot simply convert it back to FAT32 with command line. You need to reformat this partition, of course, you will lose all data so make sure before doing any change take the backup.
  1. Open Command Prompt :- Start  ---> Run ---> cmd
  2. Follow the below mentioned Syntax
                        convert drive letter: /fs:ntfs
Eg :-     convert D:/fs:ntfs
Sample :-
C:\Users\ictops>convert D:/fs:ntfs
The type of the file system is FAT32.
Volume _ICTOPS created 3/1/2015 11:05 PM
Volume Serial Number is A024-4342
Windows is verifying files and folders...
File and folder verification is complete.
Windows has scanned the file system and found no problems.
No further action is required.
  15,616,992 KB total disk space.
           8 KB in 1 hidden files.
          72 KB in 2 files.
  15,616,904 KB are available.
       8,192 bytes in each allocation unit.
    1,952,124 total allocation units on disk.
    1,952,113 allocation units available on disk.
Determining disk space required for file system conversion...
Total disk space:              15633376 KB
Free space on volume:          15616904 KB
Space required for conversion:    81842 KB
Converting file system
Data error (cyclic redundancy check).

bloggerwidgets