LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Split LVM2 partition while server is online (https://www.linuxquestions.org/questions/linux-server-73/split-lvm2-partition-while-server-is-online-804592/)

tincboy 04-27-2010 03:34 PM

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,

zordrak 04-27-2010 04:54 PM

Provide the output of pvdisplay and lvdisplay, as well as your fstab.

tincboy 04-27-2010 11:08 PM

Quote:

Originally Posted by zordrak (Post 3949777)
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.

zordrak 04-28-2010 04:06 AM

fstab is a file:

/etc/fstab

tincboy 04-28-2010 08:30 AM

Quote:

Originally Posted by zordrak (Post 3950294)
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

zordrak 04-28-2010 09:02 AM

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.

tincboy 04-28-2010 11:12 PM

Quote:

Originally Posted by zordrak (Post 3950623)
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?

zordrak 04-29-2010 05:31 AM

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.

tincboy 04-29-2010 08:54 AM

Quote:

Originally Posted by zordrak (Post 3951626)
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?


All times are GMT -5. The time now is 04:15 AM.