Add space to non lvm linux drive

Figure out what you have
 
[root@someserver k036273]# fdisk -l
 
Disk /dev/sda: 64.4 GB, 64424509440 bytes
64 heads, 32 sectors/track, 61440 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0005ccd9
 
 Device Boot Start End Blocks Id System
/dev/sda1 * 2 501 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 502 61440 62401536 8e Linux LVM -8e is Linux LVM
Partition 2 does not end on cylinder boundary.
 
Disk /dev/sdb: 483.2 GB, 483183820800 bytes
255 heads, 63 sectors/track, 58743 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xd7dfe55f
 
 Device Boot Start End Blocks Id System
/dev/sdb1 1 11227 90177536 83 Linux
/dev/sdb2 11227 19582 67108864 83 Linux
/dev/sdb3 19582 58744 314571776 83 Linux - 83 is a standard Linux partition
 
[root@someserver k036273]# df -T
Filesystem Type 1K-blocks Used Available Use% Mounted on
/dev/mapper/vg_someserver-lv_root
 ext4 33811292 5496432 26603744 18% /
tmpfs tmpfs 8233992 0 8233992 0% /dev/shm
/dev/sda1 ext4 495844 174341 295903 38% /boot
/dev/mapper/vg_someserver-lv_home
 ext4 10232056 767476 8944800 8% /home
/dev/sdb1 ext4 88762616 45073816 39179924 54% /u01
/dev/sdb2 ext4 66055932 2418768 60281724 4% /u02
/dev/sdb3 ext4 103211296 76075232 21893236 78% /u03
/dev/dm-12 ocfs2 314611712 92975104 221636608 30% /u04
 
2. Grow the drive in VMware
 
3. unmount the filesystem in question
 
umount -l /u03
 
4. Use cfdisk to identify, delete and recreate the partition with larger size. No data will be lost, but a VMware level snapshot could be your insurance
 
cfdisk /dev/sdb
 
 cfdisk (util-linux-ng 2.17.2)
 
 Disk Drive: /dev/sdb
 Size: 483183820800 bytes, 483.1 GB
 Heads: 255 Sectors per Track: 63 Cylinders: 58743
 
 Name Flags Part Type FS Type [Label] Size (MB)
-------------------------------------------------------------------------------------------------
 Pri/Log Free Space 1.05 *
 sdb1 Primary Linux ext3 92341.80 *
 sdb2 Primary Linux ext3 68719.48 *
 sdb3 Primary Linux ext3 107373.14 *
 Pri/Log Free Space 214748.37 *
 
 
 [ Help ] [ New ] [ Print ] [ Quit ] [ Units ] [ Write ]
 
5. We are deleting sdb3 partition tables, but not the data 
 
 cfdisk (util-linux-ng 2.17.2)
 
 Disk Drive: /dev/sdb
 Size: 483183820800 bytes, 483.1 GB
 Heads: 255 Sectors per Track: 63 Cylinders: 58743
 
 Name Flags Part Type FS Type [Label] Size (MB)
-------------------------------------------------------------------------------------------------
 Pri/Log Free Space 1.05 *
 sdb1 Primary Linux ext3 92341.80 *
 sdb2 Primary Linux ext3 68719.48 *
 sdb3 Primary Linux ext3 107373.14 *
 Pri/Log Free Space 214748.37 *
 
 
 [ Bootable ] [ Delete ] [ Help ] [ Maximize ] [ Print ] [ Quit ]
 [ Type ] [ Units ] [ Write ]
 
 Delete the current partition
 
6. The partition is gone but the data is still there, we are recreating a new larger partition
 
 cfdisk (util-linux-ng 2.17.2)
 
 Disk Drive: /dev/sdb
 Size: 483183820800 bytes, 483.1 GB
 Heads: 255 Sectors per Track: 63 Cylinders: 58743
 
 Name Flags Part Type FS Type [Label] Size (MB)
-------------------------------------------------------------------------------------------------
 Pri/Log Free Space 1.05 *
 sdb1 Primary Linux ext3 92341.80 *
 sdb2 Primary Linux ext3 68719.48 *
 Pri/Log Free Space 322121.50 *
 
 
 
 [ Help ] [ New ] [ Print ] [ Quit ] [ Units ] [ Write ]
 
 
 Create new partition from free space
 
7. We do not need to toggle the drive as the boot partition, this is our second vmdk
 
 cfdisk (util-linux-ng 2.17.2)
 
 Disk Drive: /dev/sdb
 Size: 483183820800 bytes, 483.1 GB
 Heads: 255 Sectors per Track: 63 Cylinders: 58743
 
 Name Flags Part Type FS Type [Label] Size (MB)
-------------------------------------------------------------------------------------------------
 Pri/Log Free Space 1.05 *
 sdb1 Primary Linux ext3 92341.80 *
 sdb2 Primary Linux ext3 68719.48 *
 sdb3 Primary Linux 322121.50 *
 
 
 
 
 
 [ Bootable ] [ Delete ] [ Help ] [ Maximize ] [ Print ] [ Quit ]
 [ Type ] [ Units ] [ Write ]
 
 Toggle bootable flag of the current partition
 
8. Write the changes
 
 cfdisk (util-linux-ng 2.17.2)
 
 Disk Drive: /dev/sdb
 Size: 483183820800 bytes, 483.1 GB
 Heads: 255 Sectors per Track: 63 Cylinders: 58743
 
 Name Flags Part Type FS Type [Label] Size (MB)
-------------------------------------------------------------------------------------------------
 Pri/Log Free Space 1.05 *
 sdb1 Primary Linux ext3 92341.80 *
 sdb2 Primary Linux ext3 68719.48 *
 sdb3 Primary Linux 322121.50 *
 
 
 
 
 
 
 [ Bootable ] [ Delete ] [ Help ] [ Maximize ] [ Print ] [ Quit ]
 [ Type ] [ Units ] [ Write ]
 
 Write partition table to disk (this might destroy data)
 
 
9. Quit cfdisk
 
 cfdisk (util-linux-ng 2.17.2)
 
 Disk Drive: /dev/sdb
 Size: 483183820800 bytes, 483.1 GB
 Heads: 255 Sectors per Track: 63 Cylinders: 58743
 
 Name Flags Part Type FS Type [Label] Size (MB)
-------------------------------------------------------------------------------------------------
 Pri/Log Free Space 1.05 *
 sdb1 Primary Linux ext3 92341.80 *
 sdb2 Primary Linux ext3 68719.48 *
 sdb3 Primary Linux 322121.50 *
 
 
 
 
 [ Bootable ] [ Delete ] [ Help ] [ Maximize ] [ Print ] [ Quit ]
 [ Type ] [ Units ] [ Write ]
 
 Quit program without writing partition table
 
10. Reboot
 
 
shutdown –r now
 
11. After reboot, the newly larger filesystem is loaded as it is specified in /etc/fstab
 
[root@someserver k036273]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_someserver-lv_root
 33G 5.3G 26G 18% /
tmpfs 7.9G 633M 7.3G 8% /dev/shm
/dev/sda1 485M 171M 289M 38% /boot
/dev/mapper/vg_someserver-lv_home
 9.8G 750M 8.6G 8% /home
/dev/sdb1 85G 43G 38G 54% /u01
/dev/sdb2 63G 2.4G 58G 4% /u02
/dev/sdb3 296G 73G 208G 26% /u03
/dev/dm-10 301G 89G 212G 30% /u04
Advertisements