Sunday, January 3, 2016

adding disk on vmware RHEL7


1. add the disk on vmware

2. Scan the disk

[root@ashok ~]#  echo "- - -"> /sys/class/scsi_host/host0/scan
[root@ashok ~]#  echo "- - -"> /sys/class/scsi_host/host1/scan
[root@ashok ~]#  echo "- - -"> /sys/class/scsi_host/host2/scan
[root@ashok ~]# fdisk -l

[root@ashok ~]# fdisk -l

Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 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 label type: dos
Disk identifier: 0x000bdad6

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048    41943039    20458496   8e  Linux LVM

Disk /dev/mapper/centos-root: 10.7 GB, 10737418240 bytes, 20971520 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 /dev/mapper/centos-swap: 3221 MB, 3221225472 bytes, 6291456 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 /dev/mapper/centos-home: 6983 MB, 6983516160 bytes, 13639680 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 /dev/sdb: 2147 MB, 2147483648 bytes, 4194304 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

[root@ashok ~]# fdisk /dev/sdb

Command (m for help): n
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p):
Using default response p
Partition number (2-4, default 2):
First sector (411648-4194303, default 411648):
Using default value 411648
Last sector, +sectors or +size{K,M,G} (411648-4194303, default 4194303): +200M
Partition 2 of type Linux and of size 200 MiB is set

Command (m for help): n
Partition type:
   p   primary (2 primary, 0 extended, 2 free)
   e   extended
Select (default p): p
Partition number (3,4, default 3):
First sector (821248-4194303, default 821248):
Using default value 821248
Last sector, +sectors or +size{K,M,G} (821248-4194303, default 4194303): +200M
Partition 3 of type Linux and of size 200 MiB is set

Command (m for help): p

Disk /dev/sdb: 2147 MB, 2147483648 bytes, 4194304 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 label type: dos
Disk identifier: 0xc3e9fc2d

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048      411647      204800   83  Linux
/dev/sdb2          411648      821247      204800   83  Linux
/dev/sdb3          821248     1230847      204800   83  Linux

Command (m for help): n
Partition type:
   p   primary (3 primary, 0 extended, 1 free)
   e   extended
Select (default e):
Using default response e
Selected partition 4
First sector (1230848-4194303, default 1230848):
Using default value 1230848
Last sector, +sectors or +size{K,M,G} (1230848-4194303, default 4194303):
Using default value 4194303
Partition 4 of type Extended and of size 1.4 GiB is set

Command (m for help): p

Disk /dev/sdb: 2147 MB, 2147483648 bytes, 4194304 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 label type: dos
Disk identifier: 0xc3e9fc2d

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048      411647      204800   83  Linux
/dev/sdb2          411648      821247      204800   83  Linux
/dev/sdb3          821248     1230847      204800   83  Linux
/dev/sdb4         1230848     4194303     1481728    5  Extended

Command (m for help): n
All primary partitions are in use
Adding logical partition 5
First sector (1232896-4194303, default 1232896):
Using default value 1232896
Last sector, +sectors or +size{K,M,G} (1232896-4194303, default 4194303): +200M
Partition 5 of type Linux and of size 200 MiB is set

Command (m for help): n
All primary partitions are in use
Adding logical partition 6
First sector (1644544-4194303, default 1644544):
Using default value 1644544
Last sector, +sectors or +size{K,M,G} (1644544-4194303, default 4194303): +200M
Partition 6 of type Linux and of size 200 MiB is set

Command (m for help): p

Disk /dev/sdb: 2147 MB, 2147483648 bytes, 4194304 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 label type: dos
Disk identifier: 0xc3e9fc2d

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048      411647      204800   83  Linux
/dev/sdb2          411648      821247      204800   83  Linux
/dev/sdb3          821248     1230847      204800   83  Linux
/dev/sdb4         1230848     4194303     1481728    5  Extended
/dev/sdb5         1232896     1642495      204800   83  Linux
/dev/sdb6         1644544     2054143      204800   83  Linux

Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   g   create a new empty GPT partition table
   G   create an IRIX (SGI) partition table
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@ashok ~]# fdisk -l

Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 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 label type: dos
Disk identifier: 0x000bdad6

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048    41943039    20458496   8e  Linux LVM

Disk /dev/mapper/centos-root: 10.7 GB, 10737418240 bytes, 20971520 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 /dev/mapper/centos-swap: 3221 MB, 3221225472 bytes, 6291456 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 /dev/mapper/centos-home: 6983 MB, 6983516160 bytes, 13639680 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 /dev/sdb: 2147 MB, 2147483648 bytes, 4194304 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 label type: dos
Disk identifier: 0xc3e9fc2d

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048      411647      204800   83  Linux
/dev/sdb2          411648      821247      204800   83  Linux
/dev/sdb3          821248     1230847      204800   83  Linux
/dev/sdb4         1230848     4194303     1481728    5  Extended
/dev/sdb5         1232896     1642495      204800   83  Linux
/dev/sdb6         1644544     2054143      204800   83  Linux
[root@ashok ~]# mkf
mkfifo       mkfontscale  mkfs.btrfs   mkfs.ext2    mkfs.ext4    mkfs.minix   mkfs.vfat
mkfontdir    mkfs         mkfs.cramfs  mkfs.ext3    mkfs.fat     mkfs.msdos   mkfs.xfs
[root@ashok ~]# mkfs
mkfs         mkfs.cramfs  mkfs.ext3    mkfs.fat     mkfs.msdos   mkfs.xfs
mkfs.btrfs   mkfs.ext2    mkfs.ext4    mkfs.minix   mkfs.vfat
[root@ashok ~]# mkfs.xfs /dev/sdb1
meta-data=/dev/sdb1              isize=256    agcount=4, agsize=12800 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0
data     =                       bsize=4096   blocks=51200, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal log           bsize=4096   blocks=853, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@ashok ~]# blkid /dev/sdb1
/dev/sdb1: UUID="1f25b100-13bc-4f91-957a-4eea740bc9f1" TYPE="xfs"
[root@ashok ~]# mount UUID="1f25b100-13bc-4f91-957a-4eea740bc9f1" /mnt
[root@ashok ~]# cd /mnt
[root@ashok mnt]# ls
[root@ashok mnt]# mkdir newdir
[root@ashok mnt]# ls
newdir
[root@ashok mnt]# touch this is so cool and I am liking it
[root@ashok mnt]# ls -ltr
total 0
drwxr-xr-x. 2 root root 6 Jan  3 17:23 newdir
-rw-r--r--. 1 root root 0 Jan  3 17:23 this
-rw-r--r--. 1 root root 0 Jan  3 17:23 is
-rw-r--r--. 1 root root 0 Jan  3 17:23 so
-rw-r--r--. 1 root root 0 Jan  3 17:23 cool
-rw-r--r--. 1 root root 0 Jan  3 17:23 and
-rw-r--r--. 1 root root 0 Jan  3 17:23 liking
-rw-r--r--. 1 root root 0 Jan  3 17:23 I
-rw-r--r--. 1 root root 0 Jan  3 17:23 am
-rw-r--r--. 1 root root 0 Jan  3 17:23 it
[root@ashok mnt]# pwd
/mnt
[root@ashok mnt]# cd /
[root@ashok /]# df -h /mnt
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb1       197M   11M  187M   6% /mnt
[root@ashok /]# umount /mnt
[root@ashok /]# df -h /mnt
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   10G  3.7G  6.4G  37% /
[root@ashok /]# cd /mnt
[root@ashok mnt]# ls
[root@ashok mnt]# ls -l
total 0
[root@ashok mnt]# cd
[root@ashok ~]# mount UUID="1f25b100-13bc-4f91-957a-4eea740bc9f1" /mnt
[root@ashok ~]# cd /mnt
[root@ashok mnt]# ls
am  and  cool  I  is  it  liking  newdir  so  this
[root@ashok mnt]#





 894  find /home -user ashok
  895  find /home -group ashok
  896  grep ashok /etc/group
  897  find /home -group kamal
  898  find /home -group devi
  899  find / -user kamal -group devi
  900  find /home -perm -777
  901  find /home -perm -222
  902  ls -l /home/ashok/n1234 /home/ashok/aaaaa /home/andy/a
  903  find /home -perm -111
  904  ls -l /home/andy/.mozilla/extensions
  905  ls -ld /home/andy/.mozilla/extensions
  906  find /home -perm -777
  907  ls -l /home/ashok/.mozilla/firefox/qpi9jfhh.default/lock
  908  p
  909  mkdir /home/abc
  910  chmod 777 /home/abc
  911  find /home -perm -777
  912  pwd
  913  find /home -size 2M
  914  find /home -size 2M -exec ls -l {} \;
  915  find /home -size 2M -exec ls -lh {} \;
  916  grep 1000 /etc/group
  917  groupadd -g 1000 ashok1
  918  find /home -size 2M -exec ls -lh {} \;
  919  groupdel ashok1
  920  find /home -size 2M -exec ls -lh {} \;
  921  find /home -mtime -130
  922  find /home -mmin -130
  923  ls -l
  924  find . -type f -links +1
  925  pwd
  926  df -l
  927  fdisk -l
  928  fdisk
  929  fdisk -l
  930  lshw
  931   echo "- - -"> /sys/class/scsi_host/host0/scan
  932   echo "- - -"> /sys/class/scsi_host/host1/scan
  933   echo "- - -"> /sys/class/scsi_host/host2/scan
  934  fdisk -l
  935  fdisk
  936  fdisk -cu /dev/sdb
  937  fdisk /dev/sdb
  938  fdisk -l
  939  mkfs.xfs /dev/sdb1
  940  blkid /dev/sdb1
  941  mount UUID="1f25b100-13bc-4f91-957a-4eea740bc9f1" /mnt
  942  cd /mnt
  943  ls
  944  mkdir newdir
  945  ls
  946  touch this is so cool and I am liking it
  947  ls -ltr
  948  pwd
  949  cd /
  950  df -h /mnt
  951  umount /mnt
  952  df -h /mnt
  953  cd /mnt
  954  ls
  955  ls -l
  956  cd
  957  mount UUID="1f25b100-13bc-4f91-957a-4eea740bc9f1" /mnt
  958  cd /mnt
  959  ls
  960  history
[root@ashok mnt]#





3. create a partition

No comments:

Post a Comment