Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Q: how to resize root partition live without reboot
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
dirtbag
Guru
Guru


Joined: 18 Feb 2003
Posts: 508
Location: NC

PostPosted: Wed Feb 24, 2010 6:53 pm    Post subject: Q: how to resize root partition live without reboot Reply with quote

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
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54799
Location: 56N 3W

PostPosted: Wed Feb 24, 2010 7:59 pm    Post subject: Reply with quote

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.

Code:
man resize2fs
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
View user's profile Send private message
dirtbag
Guru
Guru


Joined: 18 Feb 2003
Posts: 508
Location: NC

PostPosted: Wed Feb 24, 2010 8:08 pm    Post subject: Reply with quote

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
View user's profile Send private message
stobbsm
Guru
Guru


Joined: 23 May 2004
Posts: 452

PostPosted: Wed Feb 24, 2010 9:52 pm    Post subject: Reply with quote

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
View user's profile Send private message
dirtbag
Guru
Guru


Joined: 18 Feb 2003
Posts: 508
Location: NC

PostPosted: Wed Feb 24, 2010 11:18 pm    Post subject: Reply with quote

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
View user's profile Send private message
stobbsm
Guru
Guru


Joined: 23 May 2004
Posts: 452

PostPosted: Wed Feb 24, 2010 11:38 pm    Post subject: Reply with quote

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
View user's profile Send private message
dirtbag
Guru
Guru


Joined: 18 Feb 2003
Posts: 508
Location: NC

PostPosted: Wed Feb 24, 2010 11:53 pm    Post subject: Reply with quote

I guess that just gets messy after a while.

-db
Back to top
View user's profile Send private message
stobbsm
Guru
Guru


Joined: 23 May 2004
Posts: 452

PostPosted: Thu Feb 25, 2010 12:29 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum