parted extend the expanded disk

root@server:# parted /dev/sda
GNU Parted 3.2
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print free                                                  
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 2199GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start End Size File system  Name Flags
2   17.4kB  1049kB 1031kB                  bios_grub
1   1049kB  25.8GB 25.8GB  zfs
    25.8GB  25.8GB 3584B   Free Space
3   25.8GB  36.5GB 10.7GB  zfs
4   36.5GB  47.2GB 10.7GB  zfs
5   47.2GB  1100GB 1052GB  zfs
9   1100GB  1100GB 8392kB
    1100GB  2199GB 1100GB  Free Space

(parted) mkpart
Partition name?  []? <you can leave it blank>                                           
File system type?  [ext2]? zfs                                       
Start? 1100GiB                                                       
End? 100%                                                            
(parted) print                                                       
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 2199GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start End Size File system  Name Flags
2   17.4kB  1049kB 1031kB                  bios_grub
1   1049kB  25.8GB 25.8GB  zfs
3   25.8GB  36.5GB 10.7GB  zfs
4   36.5GB  47.2GB 10.7GB  zfs
5   47.2GB  1100GB 1052GB  zfs
9   1100GB  1100GB 8392kB
6   1181GB  2199GB 1018GB  zfs # this is the new one created

(parted) quit
Information: You may need to update /etc/fstab.


UEFI/GPT examples

In every instance, a special bootable EFI System Partition is required.
If creating a new EFI System Partition, use the following commands (the recommended size is 512MiB):
(parted) mkpart ESP fat32 1MiB 513MiB
(parted) set 1 boot on
The remaining partition scheme is entirely up to you. For one other partition using 100% of remaining space:
(parted) mkpart primary ext4 513MiB 100%
For separate / (20GiB) and /home (all remaining space) partitions:
(parted) mkpart primary ext4 513MiB 20.5GiB
(parted) mkpart primary ext4 20.5GiB 100%
And for separate / (20GiB), swap (4GiB), and /home (all remaining space) partitions:
(parted) mkpart primary ext4 513MiB 20.5GiB
(parted) mkpart primary linux-swap 20.5GiB 24.5GiB
(parted) mkpart primary ext4 24.5GiB 100%

Case vmware expanded

There's a difference between rescanning for new disks at the adapter level and rescanning for update size information at the disk level.
echo "- - -" > /sys/class/scsi_host/host#/scan
Sending "- - -" to /sys/class/scsi_host/host[012]/scan is telling the SCSI host adapter to look for new disks on every channel "(-)", every target "(-)", and every lun "(-)". - this is the right thing to do if you add a new disk to the system while it's powered on.
echo “1” > /sys/class/block/sdc/device/rescan
Sending a "1" to /sys/class/block/sdc/device/rescan is telling the SCSI block device to refresh it's information about where it's ending boundary is (among other things) to give the kernel information about it's updated size. - this is the right thing to do if you change the size of an existing disk while it's powered on.



Came back to using parted again today and this is how to properly create a partition using parted and getting rid of the alignment error:

Code:
root@loadtest01:~# parted /dev/sdb
GNU Parted 2.3
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mktable gpt                                                      
(parted) mkpart                                                           
Partition name?  []? primary                                        
File system type?  [ext2]? linux-swap                                    
Start? 0%                                                                 
End? 100%                                                                 
(parted) print                                                            
Model: VMware Virtual disk (scsi)
Disk /dev/sdb: 17.2GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start End     Size File system  Name Flags
1      1049kB 17.2GB  17.2GB     primary

(parted) align-check                                                      
alignment type(min/opt)  [optimal]/minimal? optimal                       
Partition number? 1                                                       
1 aligned

Increasing nofiles pam ulimit

cat /proc/{process_id}/limits:

$ cat /proc/1882/limits
Limit                     Soft Limit           Hard Limit           Units
Max cpu time              unlimited            unlimited            seconds
Max file size             unlimited            unlimited            bytes
Max open files            4096                 4096                 files
Max locked memory         65536                65536                bytes

it looks like 4096 number is too low for elastic search , now checking if the limit is reached for this PID
 /proc/{process_id}/fd is a directory that holds a file for each open file the process has,
 ls /proc/1882/fd | wc -l


/etc/pam.d/common-session needs to have this line in it:
session required pam_limits.so

/etc/pam.d/common-session-noninteractive also needs to have this line in it:
session required pam_limits.so

How to find ulimit for www-data user ?


# su www-data --shell /bin/bash --command "ulimit -aH" 
#  ulimit -aS ->will give soft limit

core file size          (blocks, -c) unlimited
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 3900
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1048576
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) unlimited
cpu time               (seconds, -t) unlimited
max user processes              (-u) 3900
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited