Try to add an New SSD into system.
I know to get the best performance should avoid LVM, but for easy extend I will using LVM here.
First make sure you are using newer fdisk (added SSD alignment support after 2.17), CentOS 7 came with 2.23.2.
# fdisk /dev/sdc
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xd6b73b64.
Command (m for help): p
Disk /dev/sdc: 214.7 GB, 214748364800 bytes, 419430400 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: 0xd6b73b64
   Device Boot      Start         End      Blocks   Id  System
Command (m for help): q
Create partition and change the flag to LVM (e8):
# fdisk -c -u /dev/sdc
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xab948127.
Command (m for help): p
Disk /dev/sdc: 214.7 GB, 214748364800 bytes, 419430400 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: 0xab948127
   Device Boot      Start         End      Blocks   Id  System
Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-419430399, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-419430399, default 419430399):
Using default value 419430399
Partition 1 of type Linux and of size 200 GiB is set
Command (m for help): p
Disk /dev/sdc: 214.7 GB, 214748364800 bytes, 419430400 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: 0xab948127
   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048   419430399   209714176   83  Linux
Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'
Command (m for help): p
Disk /dev/sdc: 214.7 GB, 214748364800 bytes, 419430400 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: 0xab948127
   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048   419430399   209714176   8e  Linux LVM
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
Create PV
# pvcreate /dev/sdc1
  Physical volume "/dev/sdc1" successfully created
Display PV
# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               centos_milliondollorserver-database
  PV Size               15.51 GiB / not usable 3.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              3970
  Free PE               0
  Allocated PE          3970
  PV UUID               tY2Myw-m0hm-sscc-Qc8M-hOfJ-XNA6-fZUIxv
  --- Physical volume ---
  PV Name               /dev/sdb1
  VG Name               VG_Backup
  PV Size               100.00 GiB / not usable 3.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              25599
  Free PE               0
  Allocated PE          25599
  PV UUID               wNDnMs-vOAL-WwAX-0N6d-xzsJ-ap85-gDbnik
  "/dev/sdc1" is a new physical volume of "200.00 GiB"
  --- NEW Physical volume ---
  PV Name               /dev/sdc1
  VG Name
  PV Size               200.00 GiB
  Allocatable           NO
  PE Size               0
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               o9Hvzz-YDy0-p8pa-aOhJ-nPtA-nNUX-kX1WzF
Create VG
# vgcreate VG_SSD00 /dev/sdc1
  Volume group "VG_SSD00" successfully created
Create LV using all free space available on the VG just created
# lvcreate -l 100%FREE -n LV_SSD_Database VG_SSD00
  Logical volume "LV_SSD_Database" created
Format in XFS
# mkfs.xfs /dev/VG_SSD00/LV_SSD_Database
meta-data=/dev/VG_SSD00/LV_SSD_Database isize=256    agcount=4, agsize=13106944                                                        blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0
data     =                       bsize=4096   blocks=52427776, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal log           bsize=4096   blocks=25599, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
Found /dev/mapper for mounting:
# ls /dev/mapper/
centos_milliondollorserver--database-root  control              VG_SSD00-LV_SSD_Database
centos_milliondollorserver--database-swap  VG_Backup-LV_Backup
Update /etc/fstab
# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Wed Oct 22 20:44:00 2014
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/centos_milliondollorserver--database-root /                       xfs     defaults        1 1
UUID=b6fc0e61-697f-42db-8be7-a6feabc8e85b /boot                   xfs     defaults        1 2
/dev/mapper/centos_milliondollorserver--database-swap swap                    swap    defaults        0 0
/dev/mapper/VG_Backup-LV_Backup            /backup                 xfs     defaults        0 0
/dev/mapper/VG_SSD00-LV_SSD_Database       /var/ssd                xfs     defaults        0 0
Mount it:
# mount /var/ssd
# df -k
To check SSD alignment:
Looking at the Start Sector, should be 2048 not 63!
# fdisk -l -u /dev/sdc
Disk /dev/sdc: 214.7 GB, 214748364800 bytes, 419430400 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: 0xab948127
   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048   419430399   209714176   8e  Linux LVM
 
No comments:
Post a Comment