You are not logged in.

#1 2008-08-15 21:53:05

COMMUNISTCHINA
Member
Registered: 2008-06-16
Posts: 122
Website

Logical Volume Manager

I am planning on installing Arch on a laptop soon. I have played with it in VirtualBox on a separate computer, and I am going to hope that it works with my touchpad / wireless mouse.

I might butcher some jargon in this, but this is how I think LVMs work, and I would like to make sure.

I am going to make partitions for boot, swap, /, and /home.
I know boot only needs to be around 100MB, swap is twice the RAM -- and I saw in another thread, / around 10-15GB -- and /home is the rest.
However, I read about installing on an LVM and it is easy to re-size partitions if needed.

I only have 1 HD, and I'm mostly doing this because while I do have room to have too much space on /, if I end up only using around 4GB, I would like to have that 11GB on my /home for music or videos.

So I think that means I would have something like this:
sda1: boot, around 100MB.
sda2: LVM, which contains swap, /, and /home.

pvcreate /dev/sda2 creates the physical volume on the LVM, allowing me to partition it.

After that, this is where I am confused.
The Arch Wiki says:

Create Volume group(s)

Next step is to create a volume group on this physical volumes. First you need to create a volume group on one of the new partitions and then add to it all other physical volumes you want to have in it:

# vgcreate VolGroup00 /dev/sda2
# vgextend VolGroup00 /dev/sdb1

Also you can use any other name you like instead of VolGroup00 for a volume group when creating it. You can track how your volume group grows with:

Can I skip this since I have only 1 HD? I guess that /dev/sdb1 is the LVM from the other harddrive?
I suppose I would have to do vgcreate VolGroup00 /dev/sda2 just to create the volume goup, though. Is this correct?

After this step, I am pretty much lost. Here's what the wiki says, and how I am interpreting it...

# lvcreate -L 10G VolGroup00 -n lvolhome
This will create a logical volume that you can access later with /dev/mapper/Volgroup00-lvolhome or /dev/VolGroup00/lvolhome. Same as with the volume groups you can use any name you want for your logical volume when creating it.

So later, I would turn this into my home partition during the Arch installation? I would create a lvolswap, and a lvolroot?
Then, during the installation process, I would format them to ext3, and mount them as /home, /, and then select lvolswap as my swap partition?

That's about it for now, I guess.

Last edited by COMMUNISTCHINA (2008-08-15 21:53:41)


i don't know you that well.

Offline

#2 2008-08-15 22:25:07

Berticus
Member
Registered: 2008-06-11
Posts: 731

Re: Logical Volume Manager

COMMUNISTCHINA wrote:

Can I skip this since I have only 1 HD? I guess that /dev/sdb1 is the LVM from the other harddrive?
I suppose I would have to do vgcreate VolGroup00 /dev/sda2 just to create the volume goup, though. Is this correct?

No, you can't skip that step, but you are correct with your other assumptions.

COMMUNISTCHINA wrote:

So later, I would turn this into my home partition during the Arch installation? I would create a lvolswap, and a lvolroot?
Then, during the installation process, I would format them to ext3, and mount them as /home, /, and then select lvolswap as my swap partition?

That's exactly what is said in the wiki. There are two ways to access the volume. The first way is through /dev/mapper/volgroup-volLabel (device mapper) and the other is /dev/volgroup/volLabel. They're basically the same thing.

Offline

#3 2008-08-15 22:44:14

COMMUNISTCHINA
Member
Registered: 2008-06-16
Posts: 122
Website

Re: Logical Volume Manager

Berticus wrote:
COMMUNISTCHINA wrote:

Can I skip this since I have only 1 HD? I guess that /dev/sdb1 is the LVM from the other harddrive?
I suppose I would have to do vgcreate VolGroup00 /dev/sda2 just to create the volume goup, though. Is this correct?

No, you can't skip that step, but you are correct with your other assumptions.

So what is this line?

# vgextend VolGroup00 /dev/sdb1


i don't know you that well.

Offline

#4 2008-08-15 22:52:14

vogt
Member
From: Toronto, Canada
Registered: 2006-11-25
Posts: 389

Re: Logical Volume Manager

@COMMUNISTCHINA vgextend vgN /dev/sdb1 extends volume group vgN to include the physical volume /dev/sdb1, which isn't necessary in your case, and the archwiki should probably be changed to make the volume group containing two physical volumes in one go, which is simpler.

Offline

#5 2008-08-16 01:18:12

COMMUNISTCHINA
Member
Registered: 2008-06-16
Posts: 122
Website

Re: Logical Volume Manager

vogt wrote:

@COMMUNISTCHINA vgextend vgN /dev/sdb1 extends volume group vgN to include the physical volume /dev/sdb1, which isn't necessary in your case, and the archwiki should probably be changed to make the volume group containing two physical volumes in one go, which is simpler.

So all I would need to do would is vgcreate VolGroup00 /dev/sda2 for that step then?


i don't know you that well.

Offline

#6 2008-08-16 03:05:11

COMMUNISTCHINA
Member
Registered: 2008-06-16
Posts: 122
Website

Re: Logical Volume Manager

Problem solved.
Just went into Virtualbox and gave it a shot.

LVM isn't as hard as it seems; hope the benefits will be worth it.

edit:
After some more Googlin', is this even worth it? I read it is even harder to recover data. Part of the reason I am putting everything in a separate partition is to make data recovery easier and keep all my documents safe in the /home partition.

Last edited by COMMUNISTCHINA (2008-08-16 03:48:04)


i don't know you that well.

Offline

#7 2008-08-16 14:29:21

peets
Member
From: Montreal
Registered: 2007-01-11
Posts: 936
Website

Re: Logical Volume Manager

meh, I created a 10G root when I last installed Arch (about a year ago), and now I have to worry about clearing pacman cache &c every now and then to avoid filling up all the space. Also, it's costly to try out any big games, but that might be a  good thing. If you have too much space in /, it's always possible do create /blah and chown it to your user. Better more than less. But I guess that you don't have to worry about that thanks to LVM. Just trying to cheer you up.

Offline

#8 2008-08-16 17:49:25

Berticus
Member
Registered: 2008-06-11
Posts: 731

Re: Logical Volume Manager

Well you're sort of mixing up two different topics now. Having many separate partitions is a different topic than if you should LVM.

I split my /usr and /opt away from /, and I'm pretty glad I did because a few days ago I had an issue with my hard drive and /usr was unrecoverable, my other data on /home and /data were completely fine.

LVM is for if you want to manage disk space easily. So if you add a hard drive, but want it to seem like one contiguous hard drive, LVM or RAID can help with that. The thing LVM offers is the ability to expand partitions conveniently. So if you made a bad prediction about the size of a particular partition, you can resize it easily.

Now if you like the idea of LVM, but worry about data recovery, I would suggest doing both RAID + LVM, more specifically an LVM on top of a RAID 1. This way you significantly minimize the recovery issue of LVM.

Offline

#9 2008-08-16 19:25:44

COMMUNISTCHINA
Member
Registered: 2008-06-16
Posts: 122
Website

Re: Logical Volume Manager

Berticus wrote:

Well you're sort of mixing up two different topics now. Having many separate partitions is a different topic than if you should LVM.

I split my /usr and /opt away from /, and I'm pretty glad I did because a few days ago I had an issue with my hard drive and /usr was unrecoverable, my other data on /home and /data were completely fine.

LVM is for if you want to manage disk space easily. So if you add a hard drive, but want it to seem like one contiguous hard drive, LVM or RAID can help with that. The thing LVM offers is the ability to expand partitions conveniently. So if you made a bad prediction about the size of a particular partition, you can resize it easily.

Now if you like the idea of LVM, but worry about data recovery, I would suggest doing both RAID + LVM, more specifically an LVM on top of a RAID 1. This way you significantly minimize the recovery issue of LVM.

Okay, well, I guess I will just do separate partitions then, and not worry about LVM.
I am concerned about not wasting too much space, but I am more concerned with ease of recovery. I have some HD space to waste, so I guess I will.


i don't know you that well.

Offline

#10 2008-08-16 22:47:19

Berticus
Member
Registered: 2008-06-11
Posts: 731

Re: Logical Volume Manager

If you're worried about easy recovery, you would've had some sort of mirroring capability already... My suggestion to you is just get an additional hard drive and RAID it regardless of whether you're going to do LVM or not.

Offline

#11 2008-08-17 00:10:12

COMMUNISTCHINA
Member
Registered: 2008-06-16
Posts: 122
Website

Re: Logical Volume Manager

Berticus wrote:

If you're worried about easy recovery, you would've had some sort of mirroring capability already... My suggestion to you is just get an additional hard drive and RAID it regardless of whether you're going to do LVM or not.

I had planned on ordering an external HD in the coming week, formatting it to ext3, and using it strictly for backup.
I know if I used separate partitions on my system, I could just do like
rsync -a / /path/to/external/root/folder
rsync -a /home /path/to/external/home/folder

Or would I need to have separate partitions on the external, one for /, and one for /home? I think a folder would work, but I don't know. I have never done any of this before.


i don't know you that well.

Offline

#12 2008-08-17 00:34:59

cactus
Taco Eater
From: ಠ_ರೃ
Registered: 2004-05-25
Posts: 4,611
Website

Re: Logical Volume Manager

lvm is hot pants. It is high on the list of my favorite linux-specific things (that and luks+cryptseupt). In my opinion, the *bsd's dont have quite as good logical volume management or on the fly disk crypto.

With lvm you can not only resize partitions (on the fly), but you can add another drive to your system, and extend the lvm across this new drive. I deal with alot of virtual instances at work, and it simply rocks there (not to mention cluster aware lvm with iscsi!). VM running low on space? Just add another virtual drive, lvextend to add the new drive to the volgroup, then resize the filesystem. Bam. More space with no instance downtime.

lvm is really nice on top of raid too. You can just raid out entire drives, then use lvm to slice it up.

however, given all the above..if you just have one disk and one 'real' install (and not providing anything exotic like being an iscsi target), then lvm honestly doesn't really buy you a whole lot. Just don't discount it for lack of awesome, because the awesome is there..even if you don't use it!
tongue


ಠ_ಠ
"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos." -- Cactus' Law

Offline

#13 2008-08-17 00:51:35

Vintendo
Member
From: Netherlands
Registered: 2008-04-21
Posts: 375
Website

Re: Logical Volume Manager

On the fly resizing:| Does that mean you can resize mounted partitions?

Offline

#14 2008-08-17 01:30:12

Berticus
Member
Registered: 2008-06-11
Posts: 731

Re: Logical Volume Manager

COMMUNISTCHINA wrote:

Or would I need to have separate partitions on the external, one for /, and one for /home? I think a folder would work, but I don't know. I have never done any of this before.

a folder will work just fine. If something were to happen, you just copy things from the folder to their correct places. However with a RAID 1 mirror, you don't need to do anything. If a hard drive fails or something, everything will operate as normal. No need to copy things over to backup since that's automatic. No need to copy things over if something were to happen.

Vintendo wrote:

On the fly resizing neutral Does that mean you can resize mounted partitions?

Yes, how else would you resize a partition? As for extending the filesystem housed on that partition, it depends on the filesystem. Ext2 and ext3 must be umounted, xfs and jfs must be mounted, reiserfs can be either or.

Offline

#15 2008-08-17 01:52:12

COMMUNISTCHINA
Member
Registered: 2008-06-16
Posts: 122
Website

Re: Logical Volume Manager

Berticus wrote:

a folder will work just fine. If something were to happen, you just copy things from the folder to their correct places. However with a RAID 1 mirror, you don't need to do anything. If a hard drive fails or something, everything will operate as normal. No need to copy things over to backup since that's automatic. No need to copy things over if something were to happen.

If I did use LVM, would rsync work just as well on that as a regular partition?
I read about LVM snapshots, but I am honestly not sure if I understand them.

I dunno. I tried using LVM on a virtualbox and I keep getting a kernel panic. I followed the Wiki.
If I put GRUB on /boot, it doesn't work, but I got it to work if I installed it on the / LV.

I think doing a RAID 1 mirror might be getting a little more advanced than I want to do now.

Thanks for the help though.


i don't know you that well.

Offline

#16 2008-08-17 05:48:09

Berticus
Member
Registered: 2008-06-11
Posts: 731

Re: Logical Volume Manager

COMMUNISTCHINA wrote:

If I did use LVM, would rsync work just as well on that as a regular partition?

I don't see why not.

COMMUNISTCHINA wrote:

I read about LVM snapshots, but I am honestly not sure if I understand them.

It's like any other snapshot really. Basically it's a copy of logical volume. It's sort of like mirroring only a specific partition. It presents the same inconvenience of backing up everything with an external hard drive - you have to do the copying instead of it being done automatically.

COMMUNISTCHINA wrote:

I dunno. I tried using LVM on a virtualbox and I keep getting a kernel panic. I followed the Wiki.
If I put GRUB on /boot, it doesn't work, but I got it to work if I installed it on the / LV.

odd, to my knowledge grub can't be on an LVM. why not install grub on MBR?

COMMUNISTCHINA wrote:

I think doing a RAID 1 mirror might be getting a little more advanced than I want to do now.

Suit yourself, only a suggestion.

Offline

#17 2008-08-17 06:06:26

COMMUNISTCHINA
Member
Registered: 2008-06-16
Posts: 122
Website

Re: Logical Volume Manager

Berticus wrote:
COMMUNISTCHINA wrote:

I dunno. I tried using LVM on a virtualbox and I keep getting a kernel panic. I followed the Wiki.
If I put GRUB on /boot, it doesn't work, but I got it to work if I installed it on the / LV.

odd, to my knowledge grub can't be on an LVM. why not install grub on MBR?

I actually figured this out maybe an hour ago.
I changed my GRUB configuration file, but since it's in a virtualbox, out of habit I type arch root=/dev/sda3 on startup, but I needed to type root=/dev/VG00/lvolroot. I had grub on /boot (not on the LVM), but when I was trying to boot, I told it to go to the wrong place for root. I could probably unmount the .iso for the vbox, but whatever.

I will read a little more about RAID.
If I end up figuring out how to do it, would I need my external hooked up to it all the time? I have tote the laptop around, and I wouldn't want the external mucking up the portability.


i don't know you that well.

Offline

#18 2008-08-17 07:54:03

cactus
Taco Eater
From: ಠ_ರೃ
Registered: 2004-05-25
Posts: 4,611
Website

Re: Logical Volume Manager

Berticus wrote:

Ext2 and ext3 must be umounted, xfs and jfs must be mounted, reiserfs can be either or.

somewhat incorrect. ext3 can be resized  (grow only) while mounted.
ext2online (older) or resize2fs (which has merged in ext2online's mounted filesystem resize I believe).
Note that you can only 'grow' a filesystem when it is mounted. Shrinking requires an unmount. The kernel has to support online-resizing too, but 2.6 does support it for ext3 (not sure about ext2).


ಠ_ಠ
"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos." -- Cactus' Law

Offline

#19 2008-08-17 13:48:41

Berticus
Member
Registered: 2008-06-11
Posts: 731

Re: Logical Volume Manager

COMMUNISTCHINA wrote:
Berticus wrote:
COMMUNISTCHINA wrote:

I dunno. I tried using LVM on a virtualbox and I keep getting a kernel panic. I followed the Wiki.
If I put GRUB on /boot, it doesn't work, but I got it to work if I installed it on the / LV.

odd, to my knowledge grub can't be on an LVM. why not install grub on MBR?

I actually figured this out maybe an hour ago.
I changed my GRUB configuration file, but since it's in a virtualbox, out of habit I type arch root=/dev/sda3 on startup, but I needed to type root=/dev/VG00/lvolroot. I had grub on /boot (not on the LVM), but when I was trying to boot, I told it to go to the wrong place for root. I could probably unmount the .iso for the vbox, but whatever.

I will read a little more about RAID.
If I end up figuring out how to do it, would I need my external hooked up to it all the time? I have tote the laptop around, and I wouldn't want the external mucking up the portability.

I wasn't aware you were on a laptop. In that case, a file server would do you best. But cheapest solution would be just to stick with an external hard drive and not RAID.

Offline

#20 2008-08-17 15:43:42

COMMUNISTCHINA
Member
Registered: 2008-06-16
Posts: 122
Website

Re: Logical Volume Manager

I think I'm just going to make standard partitions.
Maybe in a few months I will try LVM and everything, but right now I need to try to read more about them. I understand them now, but there are just too many questions I have.

Thanks for your help.


i don't know you that well.

Offline

Board footer

Powered by FluxBB