LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
LinkBack Search this Thread
Old 04-27-2010, 03:34 PM   #1
tincboy
Member
 
Registered: Apr 2010
Posts: 36

Rep: Reputation: 0
Split LVM2 partition while server is online


I need to split one of my big partitions without data loss while the server is running,
here is my df -h output:
Filesystem Size Used Avail Use% Mounted on
/dev/pve/root 95G 756M 89G 1% /
tmpfs 1003M 0 1003M 0% /lib/init/rw
udev 10M 2.7M 7.4M 27% /dev
tmpfs 1003M 4.0K 1003M 1% /dev/shm
/dev/mapper/pve-data 356G 52G 304G 15% /var/lib/vz
/dev/sda1 504M 32M 448M 7% /boot

I want to make a little partition from /dev/mapper/pve-data with size of 50 GB while the other files on that partition remain untouched,
 
Old 04-27-2010, 04:54 PM   #2
zordrak
Member
 
Registered: Feb 2008
Distribution: Slackware
Posts: 581

Rep: Reputation: 114Reputation: 114
Provide the output of pvdisplay and lvdisplay, as well as your fstab.
 
Old 04-27-2010, 11:08 PM   #3
tincboy
Member
 
Registered: Apr 2010
Posts: 36

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by zordrak View Post
Provide the output of pvdisplay and lvdisplay, as well as your fstab.
pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name pve
PV Size 465.26 GB / not usable 1.50 MB
Allocatable yes
PE Size (KByte) 4096
Total PE 119106
Free PE 1023
Allocated PE 118083
PV UUID JQbm22-HZ2o-hn1z-78iK-yZCO-XZc9-MOcNCz

-------------------------------------------------
lvdisplay
--- Logical volume ---
LV Name /dev/pve/swap
VG Name pve
LV UUID Cthq3b-q4un-xsLq-UyZa-iLD6-vKY4-Bb81RV
LV Write Access read/write
LV Status available
# open 1
LV Size 4.00 GB
Current LE 1024
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0

--- Logical volume ---
LV Name /dev/pve/root
VG Name pve
LV UUID M9z3ZZ-fg0J-eEJ0-meT1-NgMo-GhOR-BUOy4x
LV Write Access read/write
LV Status available
# open 1
LV Size 96.00 GB
Current LE 24576
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1

--- Logical volume ---
LV Name /dev/pve/data
VG Name pve
LV UUID rESyJk-R2hc-VgDj-9V50-5FLh-yA6c-nKy5wk
LV Write Access read/write
LV Status available
# open 1
LV Size 361.26 GB
Current LE 92483
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2

unfortunately fstab is not installed on my debian.
 
Old 04-28-2010, 04:06 AM   #4
zordrak
Member
 
Registered: Feb 2008
Distribution: Slackware
Posts: 581

Rep: Reputation: 114Reputation: 114
fstab is a file:

/etc/fstab
 
Old 04-28-2010, 08:30 AM   #5
tincboy
Member
 
Registered: Apr 2010
Posts: 36

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by zordrak View Post
fstab is a file:

/etc/fstab
# <file system> <mount point> <type> <options> <dump> <pass>
/dev/pve/root / ext3 errors=remount-ro 0 1
/dev/pve/data /var/lib/vz ext3 defaults 0 1
UUID=09591461-2abf-4d56-9d02-e40591f70c32 /boot ext3 defaults 0 1
/dev/pve/swap none swap sw 0 0
proc /proc proc defaults 0 0
 
Old 04-28-2010, 09:02 AM   #6
zordrak
Member
 
Registered: Feb 2008
Distribution: Slackware
Posts: 581

Rep: Reputation: 114Reputation: 114
So you need to shrink the ext3 parition that is in /dev/pve/data:
http://www.howtoforge.com/linux_resi...xt3_partitions

Then resize the lv container itself with lvresize.

Then create a new lv in the available extra space left in the pv.
 
Old 04-28-2010, 11:12 PM   #7
tincboy
Member
 
Registered: Apr 2010
Posts: 36

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by zordrak View Post
So you need to shrink the ext3 parition that is in /dev/pve/data:
http://www.howtoforge.com/linux_resi...xt3_partitions

Then resize the lv container itself with lvresize.

Then create a new lv in the available extra space left in the pv.
Thanks, I'll try it, but I've an other question: Can I have about 20 partition on a disk drive? or there's a restriction?
 
Old 04-29-2010, 05:31 AM   #8
zordrak
Member
 
Registered: Feb 2008
Distribution: Slackware
Posts: 581

Rep: Reputation: 114Reputation: 114
You can have as many Logical Volumes (as you are using lvm) as you wish, these are not the same as disk paritions.

If you were using disk partitions then you would be limited to 4 primary partitions, But a primary partition can be an extended partition which may contain more logical partitions, but these are still not the same as LVM logical volumes.
 
Old 04-29-2010, 08:54 AM   #9
tincboy
Member
 
Registered: Apr 2010
Posts: 36

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by zordrak View Post
You can have as many Logical Volumes (as you are using lvm) as you wish, these are not the same as disk paritions.

If you were using disk partitions then you would be limited to 4 primary partitions, But a primary partition can be an extended partition which may contain more logical partitions, but these are still not the same as LVM logical volumes.
I need to know I/O rate per each partition using iostat command so am I limited to 4 one of them usable with iostat command or I can have more than 4 usable with iostat?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LVM2 vs Extended Partition for multidistro HD? linus72 Linux - Newbie 1 03-03-2009 07:48 PM
Using testdisk to recover deleted lvm2 partition sstendal Linux - General 2 04-02-2008 09:30 AM
How to partition a LVM2 filesystem? nick623 Fedora 2 09-13-2007 02:43 PM
LVM2 - CentOS 4.4 - Online resizing grant-skywalker Linux - General 6 03-27-2007 10:58 PM
lvm2 /home partition mysteriously corrupt Nightfrost Linux - Hardware 0 08-20-2005 04:32 AM


All times are GMT -5. The time now is 05:55 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration