Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Is this the right way to add LVM cache?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
Mr. M
Tux's lil' helper
Tux's lil' helper


Joined: 18 Sep 2004
Posts: 89
Location: USA

PostPosted: Mon Dec 19, 2016 2:30 pm    Post subject: Is this the right way to add LVM cache? Reply with quote

I use LVM and have a logical volume for which I would like to add an SSD cache. According to the information i found, the steps to do this are as follows:

Code:

# Add SSD to volume group "vg"
vgextend vg /dev/sde1

# Create cache
lvcreate --type cache --cachemode writethrough -L 50G -n root_cachepool vg/root /dev/sde1


Is this correct? I'm confused by the first step, i.e., adding the SSD to the volume group. Doesn't this mean that LVM will also store normal (no just cache) data on the SSD? My main drive is a RAID1 array and I'm worried that if the SSD fails I would lose data if LVM stores not just cache on the SSD.
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3806
Location: Austro Bavaria

PostPosted: Wed Dec 21, 2016 9:53 pm    Post subject: Re: Is this the right way to add LVM cache? Reply with quote

Mr. M wrote:
I use LVM and have a logical volume for which I would like to add an SSD cache. According to the information i found, the steps to do this are as follows:

Code:

# Add SSD to volume group "vg"
vgextend vg /dev/sde1

# Create cache
lvcreate --type cache --cachemode writethrough -L 50G -n root_cachepool vg/root /dev/sde1


Is this correct? I'm confused by the first step, i.e., adding the SSD to the volume group. Doesn't this mean that LVM will also store normal (no just cache) data on the SSD? My main drive is a RAID1 array and I'm worried that if the SSD fails I would lose data if LVM stores not just cache on the SSD.


Quote:
vgextend vg /dev/sde1


You extend an existing volume group named vg with the partion of sde1

Quote:
lvcreate --type cache --cachemode writethrough -L 50G -n root_cachepool vg/root /dev/sde1


You create a logicial volume with some parameters which are unfamiliar for myself.

https://linux.die.net/man/8/lvcreate

Quote:
--type SegmentType
Create a logical volume that uses the specified segment type (e.g. "raid5", "mirror", "snapshot", "thin", "thin-pool"). Many segment types have a commandline switch alias that will enable their use (-s is an alias for --type snapshot). However, this argument must be used when no existing commandline switch alias is available for the desired type, as is the case with error, zero, raid1, raid10, raid4, raid5 or raid6.


Generic advise. When you do not understand what is done, just don't do it. Try reading the documentation until you understand what is done.

I do not get the point why you reference again the partition?

Usually you reference the volume group when you create logical volumes.

Quote:
The following command creates a logical volume 10 gigabytes in size in the volume group vg1.

lvcreate -L 10G vg1


In my point of view the script you provided is fishy, you may try to understand what is done ! MAybe your cache example is a new extension of the tools!

reference: https://www.centos.org/docs/5/html/Cluster_Logical_Volume_Manager/LV_create.html

I am using LVM2 for quite a while because my root and data is encrypted with luks.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo 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