centostricks

Just another WordPress.com site

Disk resize steps when we see partitions as a Separate Disk in fdisk


[root@test ~]# fdisk -lu

Disk /dev/sda: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders, total 209715200 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: 0x00073eef

Device Boot Start End Blocks Id System
/dev/sda1 * 64 208895 104416 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 208896 209715199 104753152 8e Linux LVM

Disk /dev/mapper/VG_00-LV_root: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders, total 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 identifier: 0x00000000

Disk /dev/mapper/VG_00-LV_root doesn’t contain a valid partition table

Disk /dev/mapper/VG_00-LV_swap: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders, total 2097152 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/mapper/VG_00-LV_swap doesn’t contain a valid partition table

Disk /dev/mapper/VG_00-LV_var: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders, total 62914560 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/mapper/VG_00-LV_var doesn’t contain a valid partition table

Disk /dev/mapper/VG_00-LV_tmp: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders, total 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 identifier: 0x00000000

Disk /dev/mapper/VG_00-LV_tmp doesn’t contain a valid partition table

Disk /dev/mapper/VG_00-LV_opt: 34.2 GB, 34225520640 bytes
255 heads, 63 sectors/track, 4161 cylinders, total 66846720 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/mapper/VG_00-LV_opt doesn’t contain a valid partition table
[root@test ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VG_00-LV_root
9.9G 1.4G 8.0G 15% /
tmpfs 7.8G 0 7.8G 0% /dev/shm
/dev/sda1 99M 32M 63M 34% /boot
/dev/mapper/VG_00-LV_opt
32G 317M 30G 2% /opt
/dev/mapper/VG_00-LV_tmp
2.0G 68M 1.9G 4% /tmp
/dev/mapper/VG_00-LV_var
30G 1.8G 27G 7% /var

[root@test ~]# parted /dev/sda
GNU Parted 2.1
Using /dev/sda
Welcome to GNU Parted! Type ‘help’ to view a list of commands.
(parted) print
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 107GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 32.8kB 107MB 107MB primary ext3 boot
2 107MB 80.5GB 80.4GB primary lvm

(parted) u s
(parted) print
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 209715200s
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 64s 208895s 208832s primary ext3 boot
2 208896s 157286399s 157077504s primary lvm

(parted) rm 2
Warning: WARNING: the kernel failed to re-read the partition table on /dev/sda
(Device or resource busy). As a result, it may not reflect all of your changes
until after reboot.
(parted) print
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 209715200s
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 64s 208895s 208832s primary ext3 boot

You are facing ERROR

(parted) mkpart primary 208896s 209715200s
Error: The location 209715200s is outside of the device /dev/sda.
(parted) print
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 209715200s
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 64s 208895s 208832s primary ext3 boot

You Should use the below COMMAND

(parted) mkpart primary 208896s -1s
Warning: WARNING: the kernel failed to re-read the partition table on /dev/sda
(Device or resource busy). As a result, it may not reflect all of your changes
until after reboot.
(parted) print
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 209715200s
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 64s 208895s 208832s primary ext3 boot
2 208896s 209715199s 209506304s primary

(parted) toggle 2 lvm
Warning: WARNING: the kernel failed to re-read the partition table on /dev/sda
(Device or resource busy). As a result, it may not reflect all of your changes
until after reboot.
(parted) print
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 209715200s
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 64s 208895s 208832s primary ext3 boot
2 208896s 209715199s 209506304s primary lvm

(parted) quit

Reboot the BOX

[root@test ~]# pvscan
PV /dev/sda2 VG VG_00 lvm2 [74.88 GiB / 0 free]
Total: 1 [74.88 GiB] / in use: 1 [74.88 GiB] / in no VG: 0 [0 ]
[root@test ~]# pvresize /dev/sda2
Physical volume “/dev/sda2” changed
1 physical volume(s) resized / 0 physical volume(s) not resized
[root@test ~]# pvscan
PV /dev/sda2 VG VG_00 lvm2 [99.88 GiB / 25.00 GiB free]
Total: 1 [99.88 GiB] / in use: 1 [99.88 GiB] / in no VG: 0 [0 ]
[root@test ~]# lvscan
ACTIVE ‘/dev/VG_00/LV_root’ [10.00 GiB] inherit
ACTIVE ‘/dev/VG_00/LV_var’ [30.00 GiB] inherit
ACTIVE ‘/dev/VG_00/LV_tmp’ [2.00 GiB] inherit
ACTIVE ‘/dev/VG_00/LV_swap’ [1.00 GiB] inherit
ACTIVE ‘/dev/VG_00/LV_opt’ [31.88 GiB] inherit
[root@test ~]# vgscan
Reading all physical volumes. This may take a while…
Found volume group “VG_00” using metadata type lvm2
[root@test ~]# lvextend -l +100%FREE /dev/VG_00/LV_opt
Extending logical volume LV_opt to 56.88 GiB
Logical volume LV_opt successfully resized

[root@test ~]# resize2fs /dev/VG_00/LV_opt
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/VG_00/LV_opt is mounted on /opt; on-line resizing required
old desc_blocks = 2, new_desc_blocks = 4
Performing an on-line resize of /dev/VG_00/LV_opt to 14909440 (4k) blocks.
The filesystem on /dev/VG_00/LV_opt is now 14909440 blocks long.

[root@test ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VG_00-LV_root
9.9G 1.4G 8.0G 15% /
tmpfs 7.8G 0 7.8G 0% /dev/shm
/dev/sda1 99M 32M 63M 34% /boot
/dev/mapper/VG_00-LV_opt
56G 320M 53G 1% /opt
/dev/mapper/VG_00-LV_tmp
2.0G 68M 1.9G 4% /tmp
/dev/mapper/VG_00-LV_var
30G 1.8G 27G 7% /var
[root@test ~]# lvscan
ACTIVE ‘/dev/VG_00/LV_root’ [10.00 GiB] inherit
ACTIVE ‘/dev/VG_00/LV_var’ [30.00 GiB] inherit
ACTIVE ‘/dev/VG_00/LV_tmp’ [2.00 GiB] inherit
ACTIVE ‘/dev/VG_00/LV_swap’ [1.00 GiB] inherit
ACTIVE ‘/dev/VG_00/LV_opt’ [56.88 GiB] inherit

2 responses to “Disk resize steps when we see partitions as a Separate Disk in fdisk

  1. Jack February 16, 2013 at 9:14 am

    you are actually a good webmaster. The website loading
    velocity is amazing. It seems that you are doing any unique trick.
    Furthermore, The contents are masterpiece. you have done a great process in this
    topic!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: