How to extend CentOS 5 partition on VMware?
up vote
15
down vote
favorite
I have a CentOS 5 virtual machine and I added 20GB more to disk size. How do I initialize and extend the available space?
I tried loading GParted as well, but the drive is locked; how do I unlock it?
centos partition vmware gparted
add a comment |
up vote
15
down vote
favorite
I have a CentOS 5 virtual machine and I added 20GB more to disk size. How do I initialize and extend the available space?
I tried loading GParted as well, but the drive is locked; how do I unlock it?
centos partition vmware gparted
add a comment |
up vote
15
down vote
favorite
up vote
15
down vote
favorite
I have a CentOS 5 virtual machine and I added 20GB more to disk size. How do I initialize and extend the available space?
I tried loading GParted as well, but the drive is locked; how do I unlock it?
centos partition vmware gparted
I have a CentOS 5 virtual machine and I added 20GB more to disk size. How do I initialize and extend the available space?
I tried loading GParted as well, but the drive is locked; how do I unlock it?
centos partition vmware gparted
centos partition vmware gparted
edited Nov 24 at 20:38
Rui F Ribeiro
38.3k1476127
38.3k1476127
asked Jul 12 '12 at 0:13
Andrew
221237
221237
add a comment |
add a comment |
10 Answers
10
active
oldest
votes
up vote
25
down vote
You're not going to be able to use GParted because the filesystem is on LVM and GParted does not support that.
First, TAKE A BACKUP OF THE VM. Then perform the following as "root" from a command line.
It looks like you've already rebooted but just in case, ensure the kernel recognizes the larger disk
echo 1 > /sys/class/scsi_disk/0:0:0:0/device/rescan
Resize the second partition with fdisk
fdisk /dev/sda
p # print current
d # delete
- 2
n # create
- p # primary partition
2 # partition number
- default first/last cylinders
t # change partition id
- 2
- 8e (hex code)
p # print the current again to verify it's expanded
w # write changes
Reboot the virtual machine
shutdown -r now
Once it's back up, resize the LVM physical volume
pvresize /dev/sda2
Now resize the LVM logical volume (NOTE: I'm unable to decipher what your logical volumes name is based on the screenshots and thus am assuming
LogVol00
. You can determine this by runninglvdisplay
.)
lvresize -l +100%FREE /dev/VolGroup00/LogVol00
Finally, lets resize the filesystem
resize2fs -p /dev/VolGroup00/LogVol00
Verify the filesystem is larger
df -h
Done
No reboot neded afterfdisk
. Usepartprobe
there. The SCSI-rescan is interesting - does it work on a disk in use?
– Nils
Jul 13 '12 at 20:27
1
Late to the party :p I've had issues with partprobe not re-reading partitions that were in use so I end up rebooting in almost all cases. The SCSI rescan works just fine with disks in use. You can rundmesg
to confirm the disk is seen as the new size
– TheDude
Sep 19 '12 at 18:52
sad that there is nothing lika a scsi-rescan for xen-pv-disks. But that`s another topic...
– Nils
Sep 19 '12 at 20:42
1
Thank you very much, your instructions worked perfectly!
– Chris Haas
Oct 11 '12 at 14:18
What should I be looking for after step 1 (echo&rescan)? How can I tell if the kernel recognizes the extra space or not?
– Jeff
Feb 8 '13 at 0:42
|
show 2 more comments
up vote
4
down vote
The below steps extended my partition from 12G to 26GB on a VMWare EXSi 5.5 running Centos 6 EXT4 VPS.
1) Identify the device name, which is by default /dev/sda, and confirm the new size by running the command:
# fdisk -l
2) Get list of partitions for /dev/sda device:
# ls -al /dev/sda*
brw-rw---- 1 root disk 8, 0 Dec 29 15:32 /dev/sda
brw-rw---- 1 root disk 8, 1 Dec 29 15:32 /dev/sda1
brw-rw---- 1 root disk 8, 2 Dec 29 15:32 /dev/sda2
3) Create new primary partition
# fdisk /dev/sda
Then type:
n (enter) [create new partition]
p (enter) [primary partition]
3 (enter) [next available number from listed /dev/sda partitions in 2)
(enter) [start cylinder]
(enter to use all available physical space) or specify size in +cylinders, +size{K,M,G}
t (enter) [change partition type]
3 (enter) [selecting /dev/sda3 partition]
8e (enter) [this sets partition type to Linux LVM or type L then enter to see list of types]
w (enter)
The partition table has been altered!
4) Reboot Centos 6.X then log back in with root privileges
# reboot
5) Check the new partition is ready and type '8e':
# fdisk -l
Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 2089 16264192 8e Linux LVM
/dev/sda3 2089 3916 14678054 8e Linux LVM
6) Create physical volume:
# pvcreate /dev/sda3
Physical volume "/dev/sda3" successfully created
7) Find out volume group name:
# vgdisplay
--- Volume group ---
VG Name vg_app1
...
8) Extend the physical volume:
# vgextend vg_app1 /dev/sda3
Volume group "vg_app1" successfully extended
9) Extend the existing volume group to the new physical volume (+100%FREE can be altered to desired size). Since we are extending root partition hence pointing to lv_root in vg_app1 volume group.
# lvextend -l +100%FREE /dev/vg_app1/lv_root
Size of logical volume vg_app1/lv_root changed from 11.63 GiB (2978 extents) to 25.63 GiB (6561 extents).
Logical volume lv_root successfully resized
10) Resize logical root volume:
# resize2fs /dev/vg_app1/lv_root
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/vg_app1/lv_root is mounted on /; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 2
Performing an on-line resize of /dev/vg_app1/lv_root to 6718464 (4k) blocks.
The filesystem on /dev/vg_app1/lv_root is now 6718464 blocks long.
Note: Use ext2online instead of resize2fs if it is a Red Hat virtual machine.
11) Check available space:
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_app1-lv_root
26G 10G 14G 42% /
tmpfs 9.8G 0 9.8G 0% /dev/shm
/dev/sda1 477M 88M 364M 20% /boot
add a comment |
up vote
2
down vote
Easy. Go into your VM as root.
Type "fdisk -l" - if you already see the new disk size - good.
If not - try partprobe
- if you still do not see the new disk size - reboot.
Now fdisk /dev/sda
- Write down you starting cylinder for the second partition.
- "Delete" the second partiton
- Recreate the second partiton, same starting cylinder, last cylinder for end
- set the type of the recreated partition to 8e (LVM)
- write the changes and quit fdisk
partprobe
pvresize /dev/sda2
Now your VG VolGroup00 has 20 GB more space. Do whatever you like with it. Just as you would do on a physical system (resize LVs, then resize the FS for example).
echo 1 > /sys/class/scsi_disk/0:0:0:0/device/rescan does the rescan magic without reboot
– andrej
Mar 13 '16 at 19:28
@andrej Even if the disk is in use?
– Nils
May 5 '16 at 21:24
Yes, it's low-level magic at the controller side, so it will work on mounted discs too. You only have to be sure that you enlarged the drive, not to subtract space from it.
– andrej
May 21 '16 at 7:07
add a comment |
up vote
2
down vote
Download the Gparted live CD ISO. Then attach the ISO to CentOS and boot from live cd (go to the virtual machine settings, select “CD/DVD” and select “Use ISO” from the right-side panel). Then select the partition you want to resize. Click on the partition menu (top menu bar) then click on “Resize”. Then select “Apply all operations” from “Edit” menu.
I loaded, but the drive has the lock icon.. I attached the image
– Andrew
Jul 12 '12 at 16:58
check this unix.stackexchange.com/questions/37900/…
– Manula Waidyanatha
Jul 13 '12 at 2:10
Thanks! +1 for this Particion Magic-like application suggestion.
– jstuardo
Jun 12 '15 at 14:46
add a comment |
up vote
0
down vote
Here I am taking a sample partition to expand the disk from 5GB to 7GB with out losing Data. You can change according to your free space available.
Before increasing the disk, I have taken the following details from the Linux VM:
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 6.8G 2.1G 4.5G 32% /
/dev/sda1 99M 12M 83M 13% /boot
none 252M 0 252M 0% /dev/shm
/dev/sdb1 5.0G 39M 4.7G 1% /mnt/test
# fdisk -s /dev/sdb
Disk /dev/sdb: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 652 5237158+ 83 Linux
Shut the VM down now.
Now I am going to increase the existing virtual disk (/dev/sdb
) from VMware the command prompt. Note: this task should be performed only when the VM is powered off.
Go to the location of virtual disk location.
# vmware-vdiskmanager -x 7Gb RedHatEnterprise_Linux_4-0.vmdk
Now it will grow the virtual disk to 7Gb
Now you need to power on the VM. Log into the VM using PuTTY or the console as the root user.
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 6.8G 2.1G 4.5G 32% /
/dev/sda1 99M 12M 83M 13% /boot
none 252M 0 252M 0% /dev/shm
/dev/sdb1 5.0G 39M 4.7G 1% /mnt/test
It still shows the old size. Unmount the partition which you are going to increase.
# umount /dev/sdb1
Run the file system repair on the disk
# fsck -n /dev/sdb1
Now were are goig to remove the journal from the disk to make it into an ext2 filesystem.
# tune2fs -O ^has_journal /dev/sdb1
Now start partitioning /dev/sdb
to assign the increased space to /dev/sdb1
. Note: Don’t Panic, you will not lose data here.
I am removing the existing /dev/sdb1
and recreating along with available free space.
# fdisk /dev/sdb
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
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): p
Disk /dev/sdb: 7516 MB, 7516192768 bytes
255 heads, 63 sectors/track, 913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 652 5237158+ 83 Linux
Command (m for help): d
Selected partition 1
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-913, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-913, default 913):
Using default value 913
Command (m for help): p
Disk /dev/sdb: 7516 MB, 7516192768 bytes
255 heads, 63 sectors/track, 913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 913 7333641 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
Now restart the Linux machine to take effect of the partition (we can also use partprobe
, it's strictly recommended to restart the machine).
# shutdown now -r
Now once again check the extended file system, if you skip this step, resize2fs
command will recommend running it.
# e2fsck -f /dev/sdb1
e2fsck 1.35 (28-Feb-2004)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sdb1: 13/655360 files (7.7% non-contiguous), 22121/1309289 blocks
Now resize the file system.
# resize2fs /dev/sdb1
resize2fs 1.35 (28-Feb-2004)
Resizing the filesystem on /dev/sdb1 to 1833410 (4k) blocks.
The filesystem on /dev/sdb1 is now 1833410 blocks long.
Now check the file system.
# fsck -n /dev/sdb1
fsck 1.35 (28-Feb-2004)
e2fsck 1.35 (28-Feb-2004)
/dev/sdb1: clean, 13/917504 files, 30538/1833410 blocks
Now recreate the partition with the ext3 format.
# tune2fs -j /dev/sdb1
tune2fs 1.35 (28-Feb-2004)
Creating journal inode: done
This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
Restart the Linux machine once to effectively use the ext3 filesystem.
# shutdown -r now
Once again you login to Linux box using root previleges. Now you can find the partition increased to 7 GB.
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 6.8G 2.1G 4.5G 32% /
/dev/sda1 99M 12M 83M 13% /boot
none 252M 0 252M 0% /dev/shm
/dev/sdb1 6.9G 39M 6.7G 1% /mnt/test
Why do you remove then reinstate the journal? This is not necessary, an ext3 filesystem can be extended just as well a an ext2 filesystem. Furthermore, you're missing one big piece of the puzzle: the partition to extend is on LVM.
– Gilles
Jul 12 '12 at 21:16
add a comment |
up vote
0
down vote
I just did this, in VMware, with CentOS 6.4. Answer number 1 is correct, but is missing one step, that I discovered.
In Gparted, mine also had the lock icon.
On the row with the partition, that has the lock icon, right-click and select "de-activate". That makes the lock go away.
Then you can right-click and change the partition size.
Then apply the change.
Then right-click and select "activate".
add a comment |
up vote
0
down vote
You can make steps 5 and 6 to be one by adding the -r
switch to lvresize
. That will make lvresize
run resize2fs
automatically with the required params:
lvresize -r -l +100%FREE /dev/VolGroup00/LogVol00
Welcome to the *nix StackExchange!
– user26112
Aug 7 '13 at 21:44
add a comment |
up vote
0
down vote
For CentOS 6.6 on VMWare, I did the following to increase from 30 GB to 40 GB (note I was not using LVM, just regular native linux partitions (Id 83)):
NOTE: Take a backup of your VM first in case you lose data. You should not lose data if everything goes well.
- VMWare gave me a GUI when I edited my VM before starting it to resize the amount available to the VM. I used this and extended it to 40 GB.
- I then booted up CentOS and ran 'fdisk -l' as root. I could see the new space. I then ran 'df -h' to verify that my old partition was still there.
- I then ran 'cfdisk /dev/sda' and got a textual GUI that showed my partitions. In my case the partition I wanted to resize was /dev/sda3 and was the last partition.
- I then used cfdisk to delete the partition, then create a new one with all available space. I wrote my changes and quit.
- I then rebooted the VM (shutdown now -r).
- After reboot, I used 'resize2fs /dev/sda3', where /dev/sda3 is the partition I recreated. This automatically completed the resize for me.
- Now with 'df -h' I see the new full size.
Info found from a combination of answers on this page and on http://positon.org/resize-an-ext3-ext4-partition
add a comment |
up vote
0
down vote
Another approach is to create a LVM spanned on a full disk instead of a partition.
In this case you can hot add disk using following method
blockscan --rereadpt /dev/<PV disk
pvresize /dev/<PV disk>
# The associated VG is now resized
lvresize /dev/mapper/<LV> -r -l +100%FREE
add a comment |
up vote
0
down vote
Sometimes you need to do
echo "- - -" > /sys/class/scsi_host/host<n>/scan
It depends on whether you're creating a new disk or extending an existing one as to which type of rescan is required.
add a comment |
10 Answers
10
active
oldest
votes
10 Answers
10
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
25
down vote
You're not going to be able to use GParted because the filesystem is on LVM and GParted does not support that.
First, TAKE A BACKUP OF THE VM. Then perform the following as "root" from a command line.
It looks like you've already rebooted but just in case, ensure the kernel recognizes the larger disk
echo 1 > /sys/class/scsi_disk/0:0:0:0/device/rescan
Resize the second partition with fdisk
fdisk /dev/sda
p # print current
d # delete
- 2
n # create
- p # primary partition
2 # partition number
- default first/last cylinders
t # change partition id
- 2
- 8e (hex code)
p # print the current again to verify it's expanded
w # write changes
Reboot the virtual machine
shutdown -r now
Once it's back up, resize the LVM physical volume
pvresize /dev/sda2
Now resize the LVM logical volume (NOTE: I'm unable to decipher what your logical volumes name is based on the screenshots and thus am assuming
LogVol00
. You can determine this by runninglvdisplay
.)
lvresize -l +100%FREE /dev/VolGroup00/LogVol00
Finally, lets resize the filesystem
resize2fs -p /dev/VolGroup00/LogVol00
Verify the filesystem is larger
df -h
Done
No reboot neded afterfdisk
. Usepartprobe
there. The SCSI-rescan is interesting - does it work on a disk in use?
– Nils
Jul 13 '12 at 20:27
1
Late to the party :p I've had issues with partprobe not re-reading partitions that were in use so I end up rebooting in almost all cases. The SCSI rescan works just fine with disks in use. You can rundmesg
to confirm the disk is seen as the new size
– TheDude
Sep 19 '12 at 18:52
sad that there is nothing lika a scsi-rescan for xen-pv-disks. But that`s another topic...
– Nils
Sep 19 '12 at 20:42
1
Thank you very much, your instructions worked perfectly!
– Chris Haas
Oct 11 '12 at 14:18
What should I be looking for after step 1 (echo&rescan)? How can I tell if the kernel recognizes the extra space or not?
– Jeff
Feb 8 '13 at 0:42
|
show 2 more comments
up vote
25
down vote
You're not going to be able to use GParted because the filesystem is on LVM and GParted does not support that.
First, TAKE A BACKUP OF THE VM. Then perform the following as "root" from a command line.
It looks like you've already rebooted but just in case, ensure the kernel recognizes the larger disk
echo 1 > /sys/class/scsi_disk/0:0:0:0/device/rescan
Resize the second partition with fdisk
fdisk /dev/sda
p # print current
d # delete
- 2
n # create
- p # primary partition
2 # partition number
- default first/last cylinders
t # change partition id
- 2
- 8e (hex code)
p # print the current again to verify it's expanded
w # write changes
Reboot the virtual machine
shutdown -r now
Once it's back up, resize the LVM physical volume
pvresize /dev/sda2
Now resize the LVM logical volume (NOTE: I'm unable to decipher what your logical volumes name is based on the screenshots and thus am assuming
LogVol00
. You can determine this by runninglvdisplay
.)
lvresize -l +100%FREE /dev/VolGroup00/LogVol00
Finally, lets resize the filesystem
resize2fs -p /dev/VolGroup00/LogVol00
Verify the filesystem is larger
df -h
Done
No reboot neded afterfdisk
. Usepartprobe
there. The SCSI-rescan is interesting - does it work on a disk in use?
– Nils
Jul 13 '12 at 20:27
1
Late to the party :p I've had issues with partprobe not re-reading partitions that were in use so I end up rebooting in almost all cases. The SCSI rescan works just fine with disks in use. You can rundmesg
to confirm the disk is seen as the new size
– TheDude
Sep 19 '12 at 18:52
sad that there is nothing lika a scsi-rescan for xen-pv-disks. But that`s another topic...
– Nils
Sep 19 '12 at 20:42
1
Thank you very much, your instructions worked perfectly!
– Chris Haas
Oct 11 '12 at 14:18
What should I be looking for after step 1 (echo&rescan)? How can I tell if the kernel recognizes the extra space or not?
– Jeff
Feb 8 '13 at 0:42
|
show 2 more comments
up vote
25
down vote
up vote
25
down vote
You're not going to be able to use GParted because the filesystem is on LVM and GParted does not support that.
First, TAKE A BACKUP OF THE VM. Then perform the following as "root" from a command line.
It looks like you've already rebooted but just in case, ensure the kernel recognizes the larger disk
echo 1 > /sys/class/scsi_disk/0:0:0:0/device/rescan
Resize the second partition with fdisk
fdisk /dev/sda
p # print current
d # delete
- 2
n # create
- p # primary partition
2 # partition number
- default first/last cylinders
t # change partition id
- 2
- 8e (hex code)
p # print the current again to verify it's expanded
w # write changes
Reboot the virtual machine
shutdown -r now
Once it's back up, resize the LVM physical volume
pvresize /dev/sda2
Now resize the LVM logical volume (NOTE: I'm unable to decipher what your logical volumes name is based on the screenshots and thus am assuming
LogVol00
. You can determine this by runninglvdisplay
.)
lvresize -l +100%FREE /dev/VolGroup00/LogVol00
Finally, lets resize the filesystem
resize2fs -p /dev/VolGroup00/LogVol00
Verify the filesystem is larger
df -h
Done
You're not going to be able to use GParted because the filesystem is on LVM and GParted does not support that.
First, TAKE A BACKUP OF THE VM. Then perform the following as "root" from a command line.
It looks like you've already rebooted but just in case, ensure the kernel recognizes the larger disk
echo 1 > /sys/class/scsi_disk/0:0:0:0/device/rescan
Resize the second partition with fdisk
fdisk /dev/sda
p # print current
d # delete
- 2
n # create
- p # primary partition
2 # partition number
- default first/last cylinders
t # change partition id
- 2
- 8e (hex code)
p # print the current again to verify it's expanded
w # write changes
Reboot the virtual machine
shutdown -r now
Once it's back up, resize the LVM physical volume
pvresize /dev/sda2
Now resize the LVM logical volume (NOTE: I'm unable to decipher what your logical volumes name is based on the screenshots and thus am assuming
LogVol00
. You can determine this by runninglvdisplay
.)
lvresize -l +100%FREE /dev/VolGroup00/LogVol00
Finally, lets resize the filesystem
resize2fs -p /dev/VolGroup00/LogVol00
Verify the filesystem is larger
df -h
Done
edited Jan 9 '13 at 22:54
Community♦
1
1
answered Jul 12 '12 at 21:43
TheDude
51546
51546
No reboot neded afterfdisk
. Usepartprobe
there. The SCSI-rescan is interesting - does it work on a disk in use?
– Nils
Jul 13 '12 at 20:27
1
Late to the party :p I've had issues with partprobe not re-reading partitions that were in use so I end up rebooting in almost all cases. The SCSI rescan works just fine with disks in use. You can rundmesg
to confirm the disk is seen as the new size
– TheDude
Sep 19 '12 at 18:52
sad that there is nothing lika a scsi-rescan for xen-pv-disks. But that`s another topic...
– Nils
Sep 19 '12 at 20:42
1
Thank you very much, your instructions worked perfectly!
– Chris Haas
Oct 11 '12 at 14:18
What should I be looking for after step 1 (echo&rescan)? How can I tell if the kernel recognizes the extra space or not?
– Jeff
Feb 8 '13 at 0:42
|
show 2 more comments
No reboot neded afterfdisk
. Usepartprobe
there. The SCSI-rescan is interesting - does it work on a disk in use?
– Nils
Jul 13 '12 at 20:27
1
Late to the party :p I've had issues with partprobe not re-reading partitions that were in use so I end up rebooting in almost all cases. The SCSI rescan works just fine with disks in use. You can rundmesg
to confirm the disk is seen as the new size
– TheDude
Sep 19 '12 at 18:52
sad that there is nothing lika a scsi-rescan for xen-pv-disks. But that`s another topic...
– Nils
Sep 19 '12 at 20:42
1
Thank you very much, your instructions worked perfectly!
– Chris Haas
Oct 11 '12 at 14:18
What should I be looking for after step 1 (echo&rescan)? How can I tell if the kernel recognizes the extra space or not?
– Jeff
Feb 8 '13 at 0:42
No reboot neded after
fdisk
. Use partprobe
there. The SCSI-rescan is interesting - does it work on a disk in use?– Nils
Jul 13 '12 at 20:27
No reboot neded after
fdisk
. Use partprobe
there. The SCSI-rescan is interesting - does it work on a disk in use?– Nils
Jul 13 '12 at 20:27
1
1
Late to the party :p I've had issues with partprobe not re-reading partitions that were in use so I end up rebooting in almost all cases. The SCSI rescan works just fine with disks in use. You can run
dmesg
to confirm the disk is seen as the new size– TheDude
Sep 19 '12 at 18:52
Late to the party :p I've had issues with partprobe not re-reading partitions that were in use so I end up rebooting in almost all cases. The SCSI rescan works just fine with disks in use. You can run
dmesg
to confirm the disk is seen as the new size– TheDude
Sep 19 '12 at 18:52
sad that there is nothing lika a scsi-rescan for xen-pv-disks. But that`s another topic...
– Nils
Sep 19 '12 at 20:42
sad that there is nothing lika a scsi-rescan for xen-pv-disks. But that`s another topic...
– Nils
Sep 19 '12 at 20:42
1
1
Thank you very much, your instructions worked perfectly!
– Chris Haas
Oct 11 '12 at 14:18
Thank you very much, your instructions worked perfectly!
– Chris Haas
Oct 11 '12 at 14:18
What should I be looking for after step 1 (echo&rescan)? How can I tell if the kernel recognizes the extra space or not?
– Jeff
Feb 8 '13 at 0:42
What should I be looking for after step 1 (echo&rescan)? How can I tell if the kernel recognizes the extra space or not?
– Jeff
Feb 8 '13 at 0:42
|
show 2 more comments
up vote
4
down vote
The below steps extended my partition from 12G to 26GB on a VMWare EXSi 5.5 running Centos 6 EXT4 VPS.
1) Identify the device name, which is by default /dev/sda, and confirm the new size by running the command:
# fdisk -l
2) Get list of partitions for /dev/sda device:
# ls -al /dev/sda*
brw-rw---- 1 root disk 8, 0 Dec 29 15:32 /dev/sda
brw-rw---- 1 root disk 8, 1 Dec 29 15:32 /dev/sda1
brw-rw---- 1 root disk 8, 2 Dec 29 15:32 /dev/sda2
3) Create new primary partition
# fdisk /dev/sda
Then type:
n (enter) [create new partition]
p (enter) [primary partition]
3 (enter) [next available number from listed /dev/sda partitions in 2)
(enter) [start cylinder]
(enter to use all available physical space) or specify size in +cylinders, +size{K,M,G}
t (enter) [change partition type]
3 (enter) [selecting /dev/sda3 partition]
8e (enter) [this sets partition type to Linux LVM or type L then enter to see list of types]
w (enter)
The partition table has been altered!
4) Reboot Centos 6.X then log back in with root privileges
# reboot
5) Check the new partition is ready and type '8e':
# fdisk -l
Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 2089 16264192 8e Linux LVM
/dev/sda3 2089 3916 14678054 8e Linux LVM
6) Create physical volume:
# pvcreate /dev/sda3
Physical volume "/dev/sda3" successfully created
7) Find out volume group name:
# vgdisplay
--- Volume group ---
VG Name vg_app1
...
8) Extend the physical volume:
# vgextend vg_app1 /dev/sda3
Volume group "vg_app1" successfully extended
9) Extend the existing volume group to the new physical volume (+100%FREE can be altered to desired size). Since we are extending root partition hence pointing to lv_root in vg_app1 volume group.
# lvextend -l +100%FREE /dev/vg_app1/lv_root
Size of logical volume vg_app1/lv_root changed from 11.63 GiB (2978 extents) to 25.63 GiB (6561 extents).
Logical volume lv_root successfully resized
10) Resize logical root volume:
# resize2fs /dev/vg_app1/lv_root
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/vg_app1/lv_root is mounted on /; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 2
Performing an on-line resize of /dev/vg_app1/lv_root to 6718464 (4k) blocks.
The filesystem on /dev/vg_app1/lv_root is now 6718464 blocks long.
Note: Use ext2online instead of resize2fs if it is a Red Hat virtual machine.
11) Check available space:
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_app1-lv_root
26G 10G 14G 42% /
tmpfs 9.8G 0 9.8G 0% /dev/shm
/dev/sda1 477M 88M 364M 20% /boot
add a comment |
up vote
4
down vote
The below steps extended my partition from 12G to 26GB on a VMWare EXSi 5.5 running Centos 6 EXT4 VPS.
1) Identify the device name, which is by default /dev/sda, and confirm the new size by running the command:
# fdisk -l
2) Get list of partitions for /dev/sda device:
# ls -al /dev/sda*
brw-rw---- 1 root disk 8, 0 Dec 29 15:32 /dev/sda
brw-rw---- 1 root disk 8, 1 Dec 29 15:32 /dev/sda1
brw-rw---- 1 root disk 8, 2 Dec 29 15:32 /dev/sda2
3) Create new primary partition
# fdisk /dev/sda
Then type:
n (enter) [create new partition]
p (enter) [primary partition]
3 (enter) [next available number from listed /dev/sda partitions in 2)
(enter) [start cylinder]
(enter to use all available physical space) or specify size in +cylinders, +size{K,M,G}
t (enter) [change partition type]
3 (enter) [selecting /dev/sda3 partition]
8e (enter) [this sets partition type to Linux LVM or type L then enter to see list of types]
w (enter)
The partition table has been altered!
4) Reboot Centos 6.X then log back in with root privileges
# reboot
5) Check the new partition is ready and type '8e':
# fdisk -l
Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 2089 16264192 8e Linux LVM
/dev/sda3 2089 3916 14678054 8e Linux LVM
6) Create physical volume:
# pvcreate /dev/sda3
Physical volume "/dev/sda3" successfully created
7) Find out volume group name:
# vgdisplay
--- Volume group ---
VG Name vg_app1
...
8) Extend the physical volume:
# vgextend vg_app1 /dev/sda3
Volume group "vg_app1" successfully extended
9) Extend the existing volume group to the new physical volume (+100%FREE can be altered to desired size). Since we are extending root partition hence pointing to lv_root in vg_app1 volume group.
# lvextend -l +100%FREE /dev/vg_app1/lv_root
Size of logical volume vg_app1/lv_root changed from 11.63 GiB (2978 extents) to 25.63 GiB (6561 extents).
Logical volume lv_root successfully resized
10) Resize logical root volume:
# resize2fs /dev/vg_app1/lv_root
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/vg_app1/lv_root is mounted on /; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 2
Performing an on-line resize of /dev/vg_app1/lv_root to 6718464 (4k) blocks.
The filesystem on /dev/vg_app1/lv_root is now 6718464 blocks long.
Note: Use ext2online instead of resize2fs if it is a Red Hat virtual machine.
11) Check available space:
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_app1-lv_root
26G 10G 14G 42% /
tmpfs 9.8G 0 9.8G 0% /dev/shm
/dev/sda1 477M 88M 364M 20% /boot
add a comment |
up vote
4
down vote
up vote
4
down vote
The below steps extended my partition from 12G to 26GB on a VMWare EXSi 5.5 running Centos 6 EXT4 VPS.
1) Identify the device name, which is by default /dev/sda, and confirm the new size by running the command:
# fdisk -l
2) Get list of partitions for /dev/sda device:
# ls -al /dev/sda*
brw-rw---- 1 root disk 8, 0 Dec 29 15:32 /dev/sda
brw-rw---- 1 root disk 8, 1 Dec 29 15:32 /dev/sda1
brw-rw---- 1 root disk 8, 2 Dec 29 15:32 /dev/sda2
3) Create new primary partition
# fdisk /dev/sda
Then type:
n (enter) [create new partition]
p (enter) [primary partition]
3 (enter) [next available number from listed /dev/sda partitions in 2)
(enter) [start cylinder]
(enter to use all available physical space) or specify size in +cylinders, +size{K,M,G}
t (enter) [change partition type]
3 (enter) [selecting /dev/sda3 partition]
8e (enter) [this sets partition type to Linux LVM or type L then enter to see list of types]
w (enter)
The partition table has been altered!
4) Reboot Centos 6.X then log back in with root privileges
# reboot
5) Check the new partition is ready and type '8e':
# fdisk -l
Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 2089 16264192 8e Linux LVM
/dev/sda3 2089 3916 14678054 8e Linux LVM
6) Create physical volume:
# pvcreate /dev/sda3
Physical volume "/dev/sda3" successfully created
7) Find out volume group name:
# vgdisplay
--- Volume group ---
VG Name vg_app1
...
8) Extend the physical volume:
# vgextend vg_app1 /dev/sda3
Volume group "vg_app1" successfully extended
9) Extend the existing volume group to the new physical volume (+100%FREE can be altered to desired size). Since we are extending root partition hence pointing to lv_root in vg_app1 volume group.
# lvextend -l +100%FREE /dev/vg_app1/lv_root
Size of logical volume vg_app1/lv_root changed from 11.63 GiB (2978 extents) to 25.63 GiB (6561 extents).
Logical volume lv_root successfully resized
10) Resize logical root volume:
# resize2fs /dev/vg_app1/lv_root
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/vg_app1/lv_root is mounted on /; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 2
Performing an on-line resize of /dev/vg_app1/lv_root to 6718464 (4k) blocks.
The filesystem on /dev/vg_app1/lv_root is now 6718464 blocks long.
Note: Use ext2online instead of resize2fs if it is a Red Hat virtual machine.
11) Check available space:
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_app1-lv_root
26G 10G 14G 42% /
tmpfs 9.8G 0 9.8G 0% /dev/shm
/dev/sda1 477M 88M 364M 20% /boot
The below steps extended my partition from 12G to 26GB on a VMWare EXSi 5.5 running Centos 6 EXT4 VPS.
1) Identify the device name, which is by default /dev/sda, and confirm the new size by running the command:
# fdisk -l
2) Get list of partitions for /dev/sda device:
# ls -al /dev/sda*
brw-rw---- 1 root disk 8, 0 Dec 29 15:32 /dev/sda
brw-rw---- 1 root disk 8, 1 Dec 29 15:32 /dev/sda1
brw-rw---- 1 root disk 8, 2 Dec 29 15:32 /dev/sda2
3) Create new primary partition
# fdisk /dev/sda
Then type:
n (enter) [create new partition]
p (enter) [primary partition]
3 (enter) [next available number from listed /dev/sda partitions in 2)
(enter) [start cylinder]
(enter to use all available physical space) or specify size in +cylinders, +size{K,M,G}
t (enter) [change partition type]
3 (enter) [selecting /dev/sda3 partition]
8e (enter) [this sets partition type to Linux LVM or type L then enter to see list of types]
w (enter)
The partition table has been altered!
4) Reboot Centos 6.X then log back in with root privileges
# reboot
5) Check the new partition is ready and type '8e':
# fdisk -l
Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 2089 16264192 8e Linux LVM
/dev/sda3 2089 3916 14678054 8e Linux LVM
6) Create physical volume:
# pvcreate /dev/sda3
Physical volume "/dev/sda3" successfully created
7) Find out volume group name:
# vgdisplay
--- Volume group ---
VG Name vg_app1
...
8) Extend the physical volume:
# vgextend vg_app1 /dev/sda3
Volume group "vg_app1" successfully extended
9) Extend the existing volume group to the new physical volume (+100%FREE can be altered to desired size). Since we are extending root partition hence pointing to lv_root in vg_app1 volume group.
# lvextend -l +100%FREE /dev/vg_app1/lv_root
Size of logical volume vg_app1/lv_root changed from 11.63 GiB (2978 extents) to 25.63 GiB (6561 extents).
Logical volume lv_root successfully resized
10) Resize logical root volume:
# resize2fs /dev/vg_app1/lv_root
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/vg_app1/lv_root is mounted on /; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 2
Performing an on-line resize of /dev/vg_app1/lv_root to 6718464 (4k) blocks.
The filesystem on /dev/vg_app1/lv_root is now 6718464 blocks long.
Note: Use ext2online instead of resize2fs if it is a Red Hat virtual machine.
11) Check available space:
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_app1-lv_root
26G 10G 14G 42% /
tmpfs 9.8G 0 9.8G 0% /dev/shm
/dev/sda1 477M 88M 364M 20% /boot
answered Dec 29 '14 at 17:17
webcoder.eu
412
412
add a comment |
add a comment |
up vote
2
down vote
Easy. Go into your VM as root.
Type "fdisk -l" - if you already see the new disk size - good.
If not - try partprobe
- if you still do not see the new disk size - reboot.
Now fdisk /dev/sda
- Write down you starting cylinder for the second partition.
- "Delete" the second partiton
- Recreate the second partiton, same starting cylinder, last cylinder for end
- set the type of the recreated partition to 8e (LVM)
- write the changes and quit fdisk
partprobe
pvresize /dev/sda2
Now your VG VolGroup00 has 20 GB more space. Do whatever you like with it. Just as you would do on a physical system (resize LVs, then resize the FS for example).
echo 1 > /sys/class/scsi_disk/0:0:0:0/device/rescan does the rescan magic without reboot
– andrej
Mar 13 '16 at 19:28
@andrej Even if the disk is in use?
– Nils
May 5 '16 at 21:24
Yes, it's low-level magic at the controller side, so it will work on mounted discs too. You only have to be sure that you enlarged the drive, not to subtract space from it.
– andrej
May 21 '16 at 7:07
add a comment |
up vote
2
down vote
Easy. Go into your VM as root.
Type "fdisk -l" - if you already see the new disk size - good.
If not - try partprobe
- if you still do not see the new disk size - reboot.
Now fdisk /dev/sda
- Write down you starting cylinder for the second partition.
- "Delete" the second partiton
- Recreate the second partiton, same starting cylinder, last cylinder for end
- set the type of the recreated partition to 8e (LVM)
- write the changes and quit fdisk
partprobe
pvresize /dev/sda2
Now your VG VolGroup00 has 20 GB more space. Do whatever you like with it. Just as you would do on a physical system (resize LVs, then resize the FS for example).
echo 1 > /sys/class/scsi_disk/0:0:0:0/device/rescan does the rescan magic without reboot
– andrej
Mar 13 '16 at 19:28
@andrej Even if the disk is in use?
– Nils
May 5 '16 at 21:24
Yes, it's low-level magic at the controller side, so it will work on mounted discs too. You only have to be sure that you enlarged the drive, not to subtract space from it.
– andrej
May 21 '16 at 7:07
add a comment |
up vote
2
down vote
up vote
2
down vote
Easy. Go into your VM as root.
Type "fdisk -l" - if you already see the new disk size - good.
If not - try partprobe
- if you still do not see the new disk size - reboot.
Now fdisk /dev/sda
- Write down you starting cylinder for the second partition.
- "Delete" the second partiton
- Recreate the second partiton, same starting cylinder, last cylinder for end
- set the type of the recreated partition to 8e (LVM)
- write the changes and quit fdisk
partprobe
pvresize /dev/sda2
Now your VG VolGroup00 has 20 GB more space. Do whatever you like with it. Just as you would do on a physical system (resize LVs, then resize the FS for example).
Easy. Go into your VM as root.
Type "fdisk -l" - if you already see the new disk size - good.
If not - try partprobe
- if you still do not see the new disk size - reboot.
Now fdisk /dev/sda
- Write down you starting cylinder for the second partition.
- "Delete" the second partiton
- Recreate the second partiton, same starting cylinder, last cylinder for end
- set the type of the recreated partition to 8e (LVM)
- write the changes and quit fdisk
partprobe
pvresize /dev/sda2
Now your VG VolGroup00 has 20 GB more space. Do whatever you like with it. Just as you would do on a physical system (resize LVs, then resize the FS for example).
answered Jul 13 '12 at 20:24
Nils
12.4k63670
12.4k63670
echo 1 > /sys/class/scsi_disk/0:0:0:0/device/rescan does the rescan magic without reboot
– andrej
Mar 13 '16 at 19:28
@andrej Even if the disk is in use?
– Nils
May 5 '16 at 21:24
Yes, it's low-level magic at the controller side, so it will work on mounted discs too. You only have to be sure that you enlarged the drive, not to subtract space from it.
– andrej
May 21 '16 at 7:07
add a comment |
echo 1 > /sys/class/scsi_disk/0:0:0:0/device/rescan does the rescan magic without reboot
– andrej
Mar 13 '16 at 19:28
@andrej Even if the disk is in use?
– Nils
May 5 '16 at 21:24
Yes, it's low-level magic at the controller side, so it will work on mounted discs too. You only have to be sure that you enlarged the drive, not to subtract space from it.
– andrej
May 21 '16 at 7:07
echo 1 > /sys/class/scsi_disk/0:0:0:0/device/rescan does the rescan magic without reboot
– andrej
Mar 13 '16 at 19:28
echo 1 > /sys/class/scsi_disk/0:0:0:0/device/rescan does the rescan magic without reboot
– andrej
Mar 13 '16 at 19:28
@andrej Even if the disk is in use?
– Nils
May 5 '16 at 21:24
@andrej Even if the disk is in use?
– Nils
May 5 '16 at 21:24
Yes, it's low-level magic at the controller side, so it will work on mounted discs too. You only have to be sure that you enlarged the drive, not to subtract space from it.
– andrej
May 21 '16 at 7:07
Yes, it's low-level magic at the controller side, so it will work on mounted discs too. You only have to be sure that you enlarged the drive, not to subtract space from it.
– andrej
May 21 '16 at 7:07
add a comment |
up vote
2
down vote
Download the Gparted live CD ISO. Then attach the ISO to CentOS and boot from live cd (go to the virtual machine settings, select “CD/DVD” and select “Use ISO” from the right-side panel). Then select the partition you want to resize. Click on the partition menu (top menu bar) then click on “Resize”. Then select “Apply all operations” from “Edit” menu.
I loaded, but the drive has the lock icon.. I attached the image
– Andrew
Jul 12 '12 at 16:58
check this unix.stackexchange.com/questions/37900/…
– Manula Waidyanatha
Jul 13 '12 at 2:10
Thanks! +1 for this Particion Magic-like application suggestion.
– jstuardo
Jun 12 '15 at 14:46
add a comment |
up vote
2
down vote
Download the Gparted live CD ISO. Then attach the ISO to CentOS and boot from live cd (go to the virtual machine settings, select “CD/DVD” and select “Use ISO” from the right-side panel). Then select the partition you want to resize. Click on the partition menu (top menu bar) then click on “Resize”. Then select “Apply all operations” from “Edit” menu.
I loaded, but the drive has the lock icon.. I attached the image
– Andrew
Jul 12 '12 at 16:58
check this unix.stackexchange.com/questions/37900/…
– Manula Waidyanatha
Jul 13 '12 at 2:10
Thanks! +1 for this Particion Magic-like application suggestion.
– jstuardo
Jun 12 '15 at 14:46
add a comment |
up vote
2
down vote
up vote
2
down vote
Download the Gparted live CD ISO. Then attach the ISO to CentOS and boot from live cd (go to the virtual machine settings, select “CD/DVD” and select “Use ISO” from the right-side panel). Then select the partition you want to resize. Click on the partition menu (top menu bar) then click on “Resize”. Then select “Apply all operations” from “Edit” menu.
Download the Gparted live CD ISO. Then attach the ISO to CentOS and boot from live cd (go to the virtual machine settings, select “CD/DVD” and select “Use ISO” from the right-side panel). Then select the partition you want to resize. Click on the partition menu (top menu bar) then click on “Resize”. Then select “Apply all operations” from “Edit” menu.
edited Jul 18 '12 at 1:22
Gilles
523k12610431576
523k12610431576
answered Jul 12 '12 at 3:01
Manula Waidyanatha
1,6631011
1,6631011
I loaded, but the drive has the lock icon.. I attached the image
– Andrew
Jul 12 '12 at 16:58
check this unix.stackexchange.com/questions/37900/…
– Manula Waidyanatha
Jul 13 '12 at 2:10
Thanks! +1 for this Particion Magic-like application suggestion.
– jstuardo
Jun 12 '15 at 14:46
add a comment |
I loaded, but the drive has the lock icon.. I attached the image
– Andrew
Jul 12 '12 at 16:58
check this unix.stackexchange.com/questions/37900/…
– Manula Waidyanatha
Jul 13 '12 at 2:10
Thanks! +1 for this Particion Magic-like application suggestion.
– jstuardo
Jun 12 '15 at 14:46
I loaded, but the drive has the lock icon.. I attached the image
– Andrew
Jul 12 '12 at 16:58
I loaded, but the drive has the lock icon.. I attached the image
– Andrew
Jul 12 '12 at 16:58
check this unix.stackexchange.com/questions/37900/…
– Manula Waidyanatha
Jul 13 '12 at 2:10
check this unix.stackexchange.com/questions/37900/…
– Manula Waidyanatha
Jul 13 '12 at 2:10
Thanks! +1 for this Particion Magic-like application suggestion.
– jstuardo
Jun 12 '15 at 14:46
Thanks! +1 for this Particion Magic-like application suggestion.
– jstuardo
Jun 12 '15 at 14:46
add a comment |
up vote
0
down vote
Here I am taking a sample partition to expand the disk from 5GB to 7GB with out losing Data. You can change according to your free space available.
Before increasing the disk, I have taken the following details from the Linux VM:
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 6.8G 2.1G 4.5G 32% /
/dev/sda1 99M 12M 83M 13% /boot
none 252M 0 252M 0% /dev/shm
/dev/sdb1 5.0G 39M 4.7G 1% /mnt/test
# fdisk -s /dev/sdb
Disk /dev/sdb: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 652 5237158+ 83 Linux
Shut the VM down now.
Now I am going to increase the existing virtual disk (/dev/sdb
) from VMware the command prompt. Note: this task should be performed only when the VM is powered off.
Go to the location of virtual disk location.
# vmware-vdiskmanager -x 7Gb RedHatEnterprise_Linux_4-0.vmdk
Now it will grow the virtual disk to 7Gb
Now you need to power on the VM. Log into the VM using PuTTY or the console as the root user.
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 6.8G 2.1G 4.5G 32% /
/dev/sda1 99M 12M 83M 13% /boot
none 252M 0 252M 0% /dev/shm
/dev/sdb1 5.0G 39M 4.7G 1% /mnt/test
It still shows the old size. Unmount the partition which you are going to increase.
# umount /dev/sdb1
Run the file system repair on the disk
# fsck -n /dev/sdb1
Now were are goig to remove the journal from the disk to make it into an ext2 filesystem.
# tune2fs -O ^has_journal /dev/sdb1
Now start partitioning /dev/sdb
to assign the increased space to /dev/sdb1
. Note: Don’t Panic, you will not lose data here.
I am removing the existing /dev/sdb1
and recreating along with available free space.
# fdisk /dev/sdb
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
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): p
Disk /dev/sdb: 7516 MB, 7516192768 bytes
255 heads, 63 sectors/track, 913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 652 5237158+ 83 Linux
Command (m for help): d
Selected partition 1
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-913, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-913, default 913):
Using default value 913
Command (m for help): p
Disk /dev/sdb: 7516 MB, 7516192768 bytes
255 heads, 63 sectors/track, 913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 913 7333641 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
Now restart the Linux machine to take effect of the partition (we can also use partprobe
, it's strictly recommended to restart the machine).
# shutdown now -r
Now once again check the extended file system, if you skip this step, resize2fs
command will recommend running it.
# e2fsck -f /dev/sdb1
e2fsck 1.35 (28-Feb-2004)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sdb1: 13/655360 files (7.7% non-contiguous), 22121/1309289 blocks
Now resize the file system.
# resize2fs /dev/sdb1
resize2fs 1.35 (28-Feb-2004)
Resizing the filesystem on /dev/sdb1 to 1833410 (4k) blocks.
The filesystem on /dev/sdb1 is now 1833410 blocks long.
Now check the file system.
# fsck -n /dev/sdb1
fsck 1.35 (28-Feb-2004)
e2fsck 1.35 (28-Feb-2004)
/dev/sdb1: clean, 13/917504 files, 30538/1833410 blocks
Now recreate the partition with the ext3 format.
# tune2fs -j /dev/sdb1
tune2fs 1.35 (28-Feb-2004)
Creating journal inode: done
This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
Restart the Linux machine once to effectively use the ext3 filesystem.
# shutdown -r now
Once again you login to Linux box using root previleges. Now you can find the partition increased to 7 GB.
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 6.8G 2.1G 4.5G 32% /
/dev/sda1 99M 12M 83M 13% /boot
none 252M 0 252M 0% /dev/shm
/dev/sdb1 6.9G 39M 6.7G 1% /mnt/test
Why do you remove then reinstate the journal? This is not necessary, an ext3 filesystem can be extended just as well a an ext2 filesystem. Furthermore, you're missing one big piece of the puzzle: the partition to extend is on LVM.
– Gilles
Jul 12 '12 at 21:16
add a comment |
up vote
0
down vote
Here I am taking a sample partition to expand the disk from 5GB to 7GB with out losing Data. You can change according to your free space available.
Before increasing the disk, I have taken the following details from the Linux VM:
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 6.8G 2.1G 4.5G 32% /
/dev/sda1 99M 12M 83M 13% /boot
none 252M 0 252M 0% /dev/shm
/dev/sdb1 5.0G 39M 4.7G 1% /mnt/test
# fdisk -s /dev/sdb
Disk /dev/sdb: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 652 5237158+ 83 Linux
Shut the VM down now.
Now I am going to increase the existing virtual disk (/dev/sdb
) from VMware the command prompt. Note: this task should be performed only when the VM is powered off.
Go to the location of virtual disk location.
# vmware-vdiskmanager -x 7Gb RedHatEnterprise_Linux_4-0.vmdk
Now it will grow the virtual disk to 7Gb
Now you need to power on the VM. Log into the VM using PuTTY or the console as the root user.
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 6.8G 2.1G 4.5G 32% /
/dev/sda1 99M 12M 83M 13% /boot
none 252M 0 252M 0% /dev/shm
/dev/sdb1 5.0G 39M 4.7G 1% /mnt/test
It still shows the old size. Unmount the partition which you are going to increase.
# umount /dev/sdb1
Run the file system repair on the disk
# fsck -n /dev/sdb1
Now were are goig to remove the journal from the disk to make it into an ext2 filesystem.
# tune2fs -O ^has_journal /dev/sdb1
Now start partitioning /dev/sdb
to assign the increased space to /dev/sdb1
. Note: Don’t Panic, you will not lose data here.
I am removing the existing /dev/sdb1
and recreating along with available free space.
# fdisk /dev/sdb
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
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): p
Disk /dev/sdb: 7516 MB, 7516192768 bytes
255 heads, 63 sectors/track, 913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 652 5237158+ 83 Linux
Command (m for help): d
Selected partition 1
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-913, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-913, default 913):
Using default value 913
Command (m for help): p
Disk /dev/sdb: 7516 MB, 7516192768 bytes
255 heads, 63 sectors/track, 913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 913 7333641 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
Now restart the Linux machine to take effect of the partition (we can also use partprobe
, it's strictly recommended to restart the machine).
# shutdown now -r
Now once again check the extended file system, if you skip this step, resize2fs
command will recommend running it.
# e2fsck -f /dev/sdb1
e2fsck 1.35 (28-Feb-2004)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sdb1: 13/655360 files (7.7% non-contiguous), 22121/1309289 blocks
Now resize the file system.
# resize2fs /dev/sdb1
resize2fs 1.35 (28-Feb-2004)
Resizing the filesystem on /dev/sdb1 to 1833410 (4k) blocks.
The filesystem on /dev/sdb1 is now 1833410 blocks long.
Now check the file system.
# fsck -n /dev/sdb1
fsck 1.35 (28-Feb-2004)
e2fsck 1.35 (28-Feb-2004)
/dev/sdb1: clean, 13/917504 files, 30538/1833410 blocks
Now recreate the partition with the ext3 format.
# tune2fs -j /dev/sdb1
tune2fs 1.35 (28-Feb-2004)
Creating journal inode: done
This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
Restart the Linux machine once to effectively use the ext3 filesystem.
# shutdown -r now
Once again you login to Linux box using root previleges. Now you can find the partition increased to 7 GB.
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 6.8G 2.1G 4.5G 32% /
/dev/sda1 99M 12M 83M 13% /boot
none 252M 0 252M 0% /dev/shm
/dev/sdb1 6.9G 39M 6.7G 1% /mnt/test
Why do you remove then reinstate the journal? This is not necessary, an ext3 filesystem can be extended just as well a an ext2 filesystem. Furthermore, you're missing one big piece of the puzzle: the partition to extend is on LVM.
– Gilles
Jul 12 '12 at 21:16
add a comment |
up vote
0
down vote
up vote
0
down vote
Here I am taking a sample partition to expand the disk from 5GB to 7GB with out losing Data. You can change according to your free space available.
Before increasing the disk, I have taken the following details from the Linux VM:
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 6.8G 2.1G 4.5G 32% /
/dev/sda1 99M 12M 83M 13% /boot
none 252M 0 252M 0% /dev/shm
/dev/sdb1 5.0G 39M 4.7G 1% /mnt/test
# fdisk -s /dev/sdb
Disk /dev/sdb: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 652 5237158+ 83 Linux
Shut the VM down now.
Now I am going to increase the existing virtual disk (/dev/sdb
) from VMware the command prompt. Note: this task should be performed only when the VM is powered off.
Go to the location of virtual disk location.
# vmware-vdiskmanager -x 7Gb RedHatEnterprise_Linux_4-0.vmdk
Now it will grow the virtual disk to 7Gb
Now you need to power on the VM. Log into the VM using PuTTY or the console as the root user.
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 6.8G 2.1G 4.5G 32% /
/dev/sda1 99M 12M 83M 13% /boot
none 252M 0 252M 0% /dev/shm
/dev/sdb1 5.0G 39M 4.7G 1% /mnt/test
It still shows the old size. Unmount the partition which you are going to increase.
# umount /dev/sdb1
Run the file system repair on the disk
# fsck -n /dev/sdb1
Now were are goig to remove the journal from the disk to make it into an ext2 filesystem.
# tune2fs -O ^has_journal /dev/sdb1
Now start partitioning /dev/sdb
to assign the increased space to /dev/sdb1
. Note: Don’t Panic, you will not lose data here.
I am removing the existing /dev/sdb1
and recreating along with available free space.
# fdisk /dev/sdb
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
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): p
Disk /dev/sdb: 7516 MB, 7516192768 bytes
255 heads, 63 sectors/track, 913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 652 5237158+ 83 Linux
Command (m for help): d
Selected partition 1
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-913, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-913, default 913):
Using default value 913
Command (m for help): p
Disk /dev/sdb: 7516 MB, 7516192768 bytes
255 heads, 63 sectors/track, 913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 913 7333641 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
Now restart the Linux machine to take effect of the partition (we can also use partprobe
, it's strictly recommended to restart the machine).
# shutdown now -r
Now once again check the extended file system, if you skip this step, resize2fs
command will recommend running it.
# e2fsck -f /dev/sdb1
e2fsck 1.35 (28-Feb-2004)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sdb1: 13/655360 files (7.7% non-contiguous), 22121/1309289 blocks
Now resize the file system.
# resize2fs /dev/sdb1
resize2fs 1.35 (28-Feb-2004)
Resizing the filesystem on /dev/sdb1 to 1833410 (4k) blocks.
The filesystem on /dev/sdb1 is now 1833410 blocks long.
Now check the file system.
# fsck -n /dev/sdb1
fsck 1.35 (28-Feb-2004)
e2fsck 1.35 (28-Feb-2004)
/dev/sdb1: clean, 13/917504 files, 30538/1833410 blocks
Now recreate the partition with the ext3 format.
# tune2fs -j /dev/sdb1
tune2fs 1.35 (28-Feb-2004)
Creating journal inode: done
This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
Restart the Linux machine once to effectively use the ext3 filesystem.
# shutdown -r now
Once again you login to Linux box using root previleges. Now you can find the partition increased to 7 GB.
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 6.8G 2.1G 4.5G 32% /
/dev/sda1 99M 12M 83M 13% /boot
none 252M 0 252M 0% /dev/shm
/dev/sdb1 6.9G 39M 6.7G 1% /mnt/test
Here I am taking a sample partition to expand the disk from 5GB to 7GB with out losing Data. You can change according to your free space available.
Before increasing the disk, I have taken the following details from the Linux VM:
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 6.8G 2.1G 4.5G 32% /
/dev/sda1 99M 12M 83M 13% /boot
none 252M 0 252M 0% /dev/shm
/dev/sdb1 5.0G 39M 4.7G 1% /mnt/test
# fdisk -s /dev/sdb
Disk /dev/sdb: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 652 5237158+ 83 Linux
Shut the VM down now.
Now I am going to increase the existing virtual disk (/dev/sdb
) from VMware the command prompt. Note: this task should be performed only when the VM is powered off.
Go to the location of virtual disk location.
# vmware-vdiskmanager -x 7Gb RedHatEnterprise_Linux_4-0.vmdk
Now it will grow the virtual disk to 7Gb
Now you need to power on the VM. Log into the VM using PuTTY or the console as the root user.
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 6.8G 2.1G 4.5G 32% /
/dev/sda1 99M 12M 83M 13% /boot
none 252M 0 252M 0% /dev/shm
/dev/sdb1 5.0G 39M 4.7G 1% /mnt/test
It still shows the old size. Unmount the partition which you are going to increase.
# umount /dev/sdb1
Run the file system repair on the disk
# fsck -n /dev/sdb1
Now were are goig to remove the journal from the disk to make it into an ext2 filesystem.
# tune2fs -O ^has_journal /dev/sdb1
Now start partitioning /dev/sdb
to assign the increased space to /dev/sdb1
. Note: Don’t Panic, you will not lose data here.
I am removing the existing /dev/sdb1
and recreating along with available free space.
# fdisk /dev/sdb
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
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): p
Disk /dev/sdb: 7516 MB, 7516192768 bytes
255 heads, 63 sectors/track, 913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 652 5237158+ 83 Linux
Command (m for help): d
Selected partition 1
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-913, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-913, default 913):
Using default value 913
Command (m for help): p
Disk /dev/sdb: 7516 MB, 7516192768 bytes
255 heads, 63 sectors/track, 913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 913 7333641 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
Now restart the Linux machine to take effect of the partition (we can also use partprobe
, it's strictly recommended to restart the machine).
# shutdown now -r
Now once again check the extended file system, if you skip this step, resize2fs
command will recommend running it.
# e2fsck -f /dev/sdb1
e2fsck 1.35 (28-Feb-2004)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sdb1: 13/655360 files (7.7% non-contiguous), 22121/1309289 blocks
Now resize the file system.
# resize2fs /dev/sdb1
resize2fs 1.35 (28-Feb-2004)
Resizing the filesystem on /dev/sdb1 to 1833410 (4k) blocks.
The filesystem on /dev/sdb1 is now 1833410 blocks long.
Now check the file system.
# fsck -n /dev/sdb1
fsck 1.35 (28-Feb-2004)
e2fsck 1.35 (28-Feb-2004)
/dev/sdb1: clean, 13/917504 files, 30538/1833410 blocks
Now recreate the partition with the ext3 format.
# tune2fs -j /dev/sdb1
tune2fs 1.35 (28-Feb-2004)
Creating journal inode: done
This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
Restart the Linux machine once to effectively use the ext3 filesystem.
# shutdown -r now
Once again you login to Linux box using root previleges. Now you can find the partition increased to 7 GB.
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 6.8G 2.1G 4.5G 32% /
/dev/sda1 99M 12M 83M 13% /boot
none 252M 0 252M 0% /dev/shm
/dev/sdb1 6.9G 39M 6.7G 1% /mnt/test
edited Jul 12 '12 at 21:13
Gilles
523k12610431576
523k12610431576
answered Jul 12 '12 at 14:42
Jahanzeb
195
195
Why do you remove then reinstate the journal? This is not necessary, an ext3 filesystem can be extended just as well a an ext2 filesystem. Furthermore, you're missing one big piece of the puzzle: the partition to extend is on LVM.
– Gilles
Jul 12 '12 at 21:16
add a comment |
Why do you remove then reinstate the journal? This is not necessary, an ext3 filesystem can be extended just as well a an ext2 filesystem. Furthermore, you're missing one big piece of the puzzle: the partition to extend is on LVM.
– Gilles
Jul 12 '12 at 21:16
Why do you remove then reinstate the journal? This is not necessary, an ext3 filesystem can be extended just as well a an ext2 filesystem. Furthermore, you're missing one big piece of the puzzle: the partition to extend is on LVM.
– Gilles
Jul 12 '12 at 21:16
Why do you remove then reinstate the journal? This is not necessary, an ext3 filesystem can be extended just as well a an ext2 filesystem. Furthermore, you're missing one big piece of the puzzle: the partition to extend is on LVM.
– Gilles
Jul 12 '12 at 21:16
add a comment |
up vote
0
down vote
I just did this, in VMware, with CentOS 6.4. Answer number 1 is correct, but is missing one step, that I discovered.
In Gparted, mine also had the lock icon.
On the row with the partition, that has the lock icon, right-click and select "de-activate". That makes the lock go away.
Then you can right-click and change the partition size.
Then apply the change.
Then right-click and select "activate".
add a comment |
up vote
0
down vote
I just did this, in VMware, with CentOS 6.4. Answer number 1 is correct, but is missing one step, that I discovered.
In Gparted, mine also had the lock icon.
On the row with the partition, that has the lock icon, right-click and select "de-activate". That makes the lock go away.
Then you can right-click and change the partition size.
Then apply the change.
Then right-click and select "activate".
add a comment |
up vote
0
down vote
up vote
0
down vote
I just did this, in VMware, with CentOS 6.4. Answer number 1 is correct, but is missing one step, that I discovered.
In Gparted, mine also had the lock icon.
On the row with the partition, that has the lock icon, right-click and select "de-activate". That makes the lock go away.
Then you can right-click and change the partition size.
Then apply the change.
Then right-click and select "activate".
I just did this, in VMware, with CentOS 6.4. Answer number 1 is correct, but is missing one step, that I discovered.
In Gparted, mine also had the lock icon.
On the row with the partition, that has the lock icon, right-click and select "de-activate". That makes the lock go away.
Then you can right-click and change the partition size.
Then apply the change.
Then right-click and select "activate".
answered Jun 21 '13 at 18:46
user41633
1
1
add a comment |
add a comment |
up vote
0
down vote
You can make steps 5 and 6 to be one by adding the -r
switch to lvresize
. That will make lvresize
run resize2fs
automatically with the required params:
lvresize -r -l +100%FREE /dev/VolGroup00/LogVol00
Welcome to the *nix StackExchange!
– user26112
Aug 7 '13 at 21:44
add a comment |
up vote
0
down vote
You can make steps 5 and 6 to be one by adding the -r
switch to lvresize
. That will make lvresize
run resize2fs
automatically with the required params:
lvresize -r -l +100%FREE /dev/VolGroup00/LogVol00
Welcome to the *nix StackExchange!
– user26112
Aug 7 '13 at 21:44
add a comment |
up vote
0
down vote
up vote
0
down vote
You can make steps 5 and 6 to be one by adding the -r
switch to lvresize
. That will make lvresize
run resize2fs
automatically with the required params:
lvresize -r -l +100%FREE /dev/VolGroup00/LogVol00
You can make steps 5 and 6 to be one by adding the -r
switch to lvresize
. That will make lvresize
run resize2fs
automatically with the required params:
lvresize -r -l +100%FREE /dev/VolGroup00/LogVol00
edited Aug 7 '13 at 20:49
Anthon
59.9k17102163
59.9k17102163
answered Aug 7 '13 at 20:33
user44724
1
1
Welcome to the *nix StackExchange!
– user26112
Aug 7 '13 at 21:44
add a comment |
Welcome to the *nix StackExchange!
– user26112
Aug 7 '13 at 21:44
Welcome to the *nix StackExchange!
– user26112
Aug 7 '13 at 21:44
Welcome to the *nix StackExchange!
– user26112
Aug 7 '13 at 21:44
add a comment |
up vote
0
down vote
For CentOS 6.6 on VMWare, I did the following to increase from 30 GB to 40 GB (note I was not using LVM, just regular native linux partitions (Id 83)):
NOTE: Take a backup of your VM first in case you lose data. You should not lose data if everything goes well.
- VMWare gave me a GUI when I edited my VM before starting it to resize the amount available to the VM. I used this and extended it to 40 GB.
- I then booted up CentOS and ran 'fdisk -l' as root. I could see the new space. I then ran 'df -h' to verify that my old partition was still there.
- I then ran 'cfdisk /dev/sda' and got a textual GUI that showed my partitions. In my case the partition I wanted to resize was /dev/sda3 and was the last partition.
- I then used cfdisk to delete the partition, then create a new one with all available space. I wrote my changes and quit.
- I then rebooted the VM (shutdown now -r).
- After reboot, I used 'resize2fs /dev/sda3', where /dev/sda3 is the partition I recreated. This automatically completed the resize for me.
- Now with 'df -h' I see the new full size.
Info found from a combination of answers on this page and on http://positon.org/resize-an-ext3-ext4-partition
add a comment |
up vote
0
down vote
For CentOS 6.6 on VMWare, I did the following to increase from 30 GB to 40 GB (note I was not using LVM, just regular native linux partitions (Id 83)):
NOTE: Take a backup of your VM first in case you lose data. You should not lose data if everything goes well.
- VMWare gave me a GUI when I edited my VM before starting it to resize the amount available to the VM. I used this and extended it to 40 GB.
- I then booted up CentOS and ran 'fdisk -l' as root. I could see the new space. I then ran 'df -h' to verify that my old partition was still there.
- I then ran 'cfdisk /dev/sda' and got a textual GUI that showed my partitions. In my case the partition I wanted to resize was /dev/sda3 and was the last partition.
- I then used cfdisk to delete the partition, then create a new one with all available space. I wrote my changes and quit.
- I then rebooted the VM (shutdown now -r).
- After reboot, I used 'resize2fs /dev/sda3', where /dev/sda3 is the partition I recreated. This automatically completed the resize for me.
- Now with 'df -h' I see the new full size.
Info found from a combination of answers on this page and on http://positon.org/resize-an-ext3-ext4-partition
add a comment |
up vote
0
down vote
up vote
0
down vote
For CentOS 6.6 on VMWare, I did the following to increase from 30 GB to 40 GB (note I was not using LVM, just regular native linux partitions (Id 83)):
NOTE: Take a backup of your VM first in case you lose data. You should not lose data if everything goes well.
- VMWare gave me a GUI when I edited my VM before starting it to resize the amount available to the VM. I used this and extended it to 40 GB.
- I then booted up CentOS and ran 'fdisk -l' as root. I could see the new space. I then ran 'df -h' to verify that my old partition was still there.
- I then ran 'cfdisk /dev/sda' and got a textual GUI that showed my partitions. In my case the partition I wanted to resize was /dev/sda3 and was the last partition.
- I then used cfdisk to delete the partition, then create a new one with all available space. I wrote my changes and quit.
- I then rebooted the VM (shutdown now -r).
- After reboot, I used 'resize2fs /dev/sda3', where /dev/sda3 is the partition I recreated. This automatically completed the resize for me.
- Now with 'df -h' I see the new full size.
Info found from a combination of answers on this page and on http://positon.org/resize-an-ext3-ext4-partition
For CentOS 6.6 on VMWare, I did the following to increase from 30 GB to 40 GB (note I was not using LVM, just regular native linux partitions (Id 83)):
NOTE: Take a backup of your VM first in case you lose data. You should not lose data if everything goes well.
- VMWare gave me a GUI when I edited my VM before starting it to resize the amount available to the VM. I used this and extended it to 40 GB.
- I then booted up CentOS and ran 'fdisk -l' as root. I could see the new space. I then ran 'df -h' to verify that my old partition was still there.
- I then ran 'cfdisk /dev/sda' and got a textual GUI that showed my partitions. In my case the partition I wanted to resize was /dev/sda3 and was the last partition.
- I then used cfdisk to delete the partition, then create a new one with all available space. I wrote my changes and quit.
- I then rebooted the VM (shutdown now -r).
- After reboot, I used 'resize2fs /dev/sda3', where /dev/sda3 is the partition I recreated. This automatically completed the resize for me.
- Now with 'df -h' I see the new full size.
Info found from a combination of answers on this page and on http://positon.org/resize-an-ext3-ext4-partition
edited Jun 15 '15 at 17:11
answered Jun 15 '15 at 17:01
Shygar
1012
1012
add a comment |
add a comment |
up vote
0
down vote
Another approach is to create a LVM spanned on a full disk instead of a partition.
In this case you can hot add disk using following method
blockscan --rereadpt /dev/<PV disk
pvresize /dev/<PV disk>
# The associated VG is now resized
lvresize /dev/mapper/<LV> -r -l +100%FREE
add a comment |
up vote
0
down vote
Another approach is to create a LVM spanned on a full disk instead of a partition.
In this case you can hot add disk using following method
blockscan --rereadpt /dev/<PV disk
pvresize /dev/<PV disk>
# The associated VG is now resized
lvresize /dev/mapper/<LV> -r -l +100%FREE
add a comment |
up vote
0
down vote
up vote
0
down vote
Another approach is to create a LVM spanned on a full disk instead of a partition.
In this case you can hot add disk using following method
blockscan --rereadpt /dev/<PV disk
pvresize /dev/<PV disk>
# The associated VG is now resized
lvresize /dev/mapper/<LV> -r -l +100%FREE
Another approach is to create a LVM spanned on a full disk instead of a partition.
In this case you can hot add disk using following method
blockscan --rereadpt /dev/<PV disk
pvresize /dev/<PV disk>
# The associated VG is now resized
lvresize /dev/mapper/<LV> -r -l +100%FREE
answered Jul 7 '15 at 8:27
ThinkBriK
1
1
add a comment |
add a comment |
up vote
0
down vote
Sometimes you need to do
echo "- - -" > /sys/class/scsi_host/host<n>/scan
It depends on whether you're creating a new disk or extending an existing one as to which type of rescan is required.
add a comment |
up vote
0
down vote
Sometimes you need to do
echo "- - -" > /sys/class/scsi_host/host<n>/scan
It depends on whether you're creating a new disk or extending an existing one as to which type of rescan is required.
add a comment |
up vote
0
down vote
up vote
0
down vote
Sometimes you need to do
echo "- - -" > /sys/class/scsi_host/host<n>/scan
It depends on whether you're creating a new disk or extending an existing one as to which type of rescan is required.
Sometimes you need to do
echo "- - -" > /sys/class/scsi_host/host<n>/scan
It depends on whether you're creating a new disk or extending an existing one as to which type of rescan is required.
answered Jul 22 '15 at 20:37
Robert B.
211
211
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f42857%2fhow-to-extend-centos-5-partition-on-vmware%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown