Вы находитесь на странице: 1из 10

Increasing Volume Of Linux OS Partition

===========================================

login as: root


root@192.168.178.3's password:
Last login: Wed Aug 15 17:35:04 2018 from 192.168.178.1
[root@mamun ~]#
[root@mamun ~]#
[root@mamun ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 rhel lvm2 a-- <25.37g 4.00m
[root@mamun ~]#
[root@mamun ~]#
[root@mamun ~]# fdisk -l

Disk /dev/sda: 28.3 GB, 28316811264 bytes, 55306272 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: 0x000e36a8

Device Boot Start End Blocks Id System


/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 55306239 26603520 8e Linux LVM
Disk /dev/sdb: 135.7 GB, 135663190016 bytes, 264967168 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/rhel-root: 25.1 GB, 25086132224 bytes, 48996352 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/rhel-swap: 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@mamun ~]#
[root@mamun ~]#
[root@mamun ~]# fdisk /dev/sdb
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 0x6b35ab67.

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): 1
First sector (2048-264967167, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-264967167, default 264967167):
+100G
Partition 1 of type Linux and of size 100 GiB is set

Command (m for help): p

Disk /dev/sdb: 135.7 GB, 135663190016 bytes, 264967168 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: 0x6b35ab67

Device Boot Start End Blocks Id System


/dev/sdb1 2048 209717247 104857600 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/sdb: 135.7 GB, 135663190016 bytes, 264967168 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: 0x6b35ab67

Device Boot Start End Blocks Id System


/dev/sdb1 2048 209717247 104857600 8e Linux LVM
Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.


Syncing disks.
[root@mamun ~]#
[root@mamun ~]#
[root@mamun ~]#
[root@mamun ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 26.4G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 25.4G 0 part
├─rhel-root 253:0 0 23.4G 0 lvm /
└─rhel-swap 253:1 0 2G 0 lvm [SWAP]
sdb 8:16 0 126.4G 0 disk
└─sdb1 8:17 0 100G 0 part
sr0 11:0 1 1024M 0 rom
[root@mamun ~]#
[root@mamun ~]#
[root@mamun ~]#
[root@mamun ~]#
[root@mamun ~]# pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created.

[root@mamun ~]#
[root@mamun ~]#
[root@mamun ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 rhel lvm2 a-- <25.37g 4.00m
/dev/sdb1 lvm2 --- 100.00g 100.00g

[root@mamun ~]#
[root@mamun ~]#
[root@mamun ~]# vgextend rhel /dev/sdb1
Volume group "rhel" successfully extended

[root@mamun ~]#
[root@mamun ~]#
[root@mamun ~]# vgs
VG #PV #LV #SN Attr VSize VFree
rhel 2 2 0 wz--n- 125.36g 100.00g

[root@mamun ~]#
[root@mamun ~]#
[root@mamun ~]# lvextend -l 100%FREE /dev/rhel/root
Size of logical volume rhel/root changed from 23.36 GiB (5981 extents) to 100.
00 GiB (25600 extents).
Logical volume rhel/root successfully resized.
[root@mamun ~]#
[root@mamun ~]#
[root@mamun ~]#
[root@mamun ~]# resize2fs /dev/rhel/root
resize2fs 1.42.9 (28-Dec-2013)
resize2fs: Bad magic number in super-block while trying to open /dev/rhel/root
Couldn't find valid filesystem superblock.

[root@mamun ~]#
[root@mamun ~]#
[root@mamun ~]# df -Th /
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/rhel-root xfs 24G 24G 152K 100% /

[root@mamun ~]#
[root@mamun ~]#
[root@mamun ~]# resize2fs /dev/rhel/root
resize2fs 1.42.9 (28-Dec-2013)
resize2fs: Bad magic number in super-block while trying to open /dev/rhel/root
Couldn't find valid filesystem superblock.

[root@mamun ~]#
[root@mamun ~]#
[root@mamun ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync
Convert
root rhel -wi-ao---- 100.00g
swap rhel -wi-ao---- 2.00g

[root@mamun ~]#
[root@mamun ~]#
[root@mamun ~]# df -Th /
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/rhel-root xfs 24G 24G 152K 100% /

[root@mamun ~]#
[root@mamun ~]#
[root@mamun ~]# xfs_growfs
Usage: xfs_growfs [options] mountpoint

Options:
-d grow data/metadata section
-l grow log section
-r grow realtime section
-n don't change anything, just show geometry
-i convert log from external to internal format
-t alternate location for mount table (/etc/mtab)
-x convert log from internal to external format
-D size grow data/metadata section to size blks
-L size grow/shrink log section to size blks
-R size grow realtime section to size blks
-e size set realtime extent size to size blks
-m imaxpct set inode max percent to imaxpct
-V print version information

[root@mamun ~]#
[root@mamun ~]#
[root@mamun ~]# xfs_growfs /dev/rhel/root
meta-data=/dev/mapper/rhel-root isize=512 agcount=4, agsize=1531136 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=6124544, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=2990, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 6124544 to 26214400

[root@mamun ~]#
[root@mamun ~]#
[root@mamun ~]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/rhel-root xfs 100G 24G 77G 24% /
devtmpfs devtmpfs 862M 0 862M 0% /dev
tmpfs tmpfs 878M 0 878M 0% /dev/shm
tmpfs tmpfs 878M 9.2M 869M 2% /run
tmpfs tmpfs 878M 0 878M 0% /sys/fs/cgroup
/dev/sda1 xfs 1014M 212M 803M 21% /boot
tmpfs tmpfs 176M 12K 176M 1% /run/user/42
tmpfs tmpfs 176M 0 176M 0% /run/user/0

[root@mamun ~]#
[root@mamun ~]#
[root@mamun ~]# df -Th /
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/rhel-root xfs 100G 24G 77G 24% /
[root@mamun ~]#

Вам также может понравиться