View previous topic :: View next topic |
Author |
Message |
dirtbag Guru
Joined: 18 Feb 2003 Posts: 508 Location: NC
|
Posted: Wed Feb 24, 2010 6:53 pm Post subject: Q: how to resize root partition live without reboot |
|
|
Just curious if anyone has come up with a good way to do this with
root partition on an ext3 filesystem under lvm2 control
we are trying to figure out if this can be done on a linux guest under ESXi server.
I have gotten as far as getting Linux to see the "resized" disk, but not lvm.
maybe with another filesystem type?
any ideas? CAN IT BE DONE?!
-db |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54799 Location: 56N 3W
|
Posted: Wed Feb 24, 2010 7:59 pm Post subject: |
|
|
dirtbag,
It should justwork as it does with any other partition. ext3 supports online resizing.
I must say that I've only ever grown partitions in LVM, then its grow the partition, grow the filesystem
For a shrink, its the other way round, shrink the filesystem, shrink the partition. Do make sure that the partition is bigger than the filesystem at all times.
may be your friend. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
dirtbag Guru
Joined: 18 Feb 2003 Posts: 508 Location: NC
|
Posted: Wed Feb 24, 2010 8:08 pm Post subject: |
|
|
yeah, know how it all is *supposed* to work.. but it just doesnt seem to work on a live / partition without reboot..
-db |
|
Back to top |
|
|
stobbsm Guru
Joined: 23 May 2004 Posts: 452
|
Posted: Wed Feb 24, 2010 9:52 pm Post subject: |
|
|
It has always worked for me.
What commands are you using?
I always do:
Code: | lvextend -L+100M /path/to/lvm/devfile
resize2fs /path/to/lvm/devfile |
and have never had a problem. _________________ Sysadmin of Ubuntu systems and servers....
Although my own server is gentoo.... |
|
Back to top |
|
|
dirtbag Guru
Joined: 18 Feb 2003 Posts: 508 Location: NC
|
Posted: Wed Feb 24, 2010 11:18 pm Post subject: |
|
|
ok, so here is mr linux box:
Code: |
[root@tacsuns-linux ~]# fdisk -l /dev/sdb
Disk /dev/sdb: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 2885 23173731 8e Linux LVM
[root@tacsuns-linux ~]#
[root@tacsuns-linux ~]# pvs
/dev/hdc: open failed: No medium found
PV VG Fmt Attr PSize PFree
/dev/sdb1 vg0 lvm2 a- 22.09G 96.00M
|
I delete the partition and re-add it with the "bigger" size..
Code: |
[root@tacsuns-linux ~]# fdisk /dev/sdb
The number of cylinders for this disk is set to 3916.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): p
Disk /dev/sdb: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 2885 23173731 8e Linux LVM
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-3916, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-3916, default 3916):
Using default value 3916
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)
Command (m for help): p
Disk /dev/sdb: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 3916 31455238+ 8e Linux LVM
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
[root@tacsuns-linux ~]#
make linux rescan it..
echo 1 > /sys/bus/scsi/drivers/sd/0:0:1:0/rescan
partprobe
[root@tacsuns-linux ~]# pvresize /dev/sdb1
/dev/hdc: open failed: No medium found
Physical volume "/dev/sdb1" changed
1 physical volume(s) resized / 0 physical volume(s) not resized
[root@tacsuns-linux ~]# pvs
/dev/hdc: open failed: No medium found
PV VG Fmt Attr PSize PFree
/dev/sdb1 vg0 lvm2 a- 22.09G 96.00M
[root@tacsuns-linux ~]#
|
fdisk clearly shows the disk as having ~30 gigs, but pvs still reports the size as 22.09G
-db |
|
Back to top |
|
|
stobbsm Guru
Joined: 23 May 2004 Posts: 452
|
Posted: Wed Feb 24, 2010 11:38 pm Post subject: |
|
|
Why wouldn't you just create a new partition and then add it to the vg? That is the power of lvm. _________________ Sysadmin of Ubuntu systems and servers....
Although my own server is gentoo.... |
|
Back to top |
|
|
dirtbag Guru
Joined: 18 Feb 2003 Posts: 508 Location: NC
|
Posted: Wed Feb 24, 2010 11:53 pm Post subject: |
|
|
I guess that just gets messy after a while.
-db |
|
Back to top |
|
|
stobbsm Guru
Joined: 23 May 2004 Posts: 452
|
Posted: Thu Feb 25, 2010 12:29 am Post subject: |
|
|
If you have maybe 500 different HD's to do it with, otherwise it's the way it's designed to work.
I don't think it can be resized that way without re-creating the vg. _________________ Sysadmin of Ubuntu systems and servers....
Although my own server is gentoo.... |
|
Back to top |
|
|
|