Gentoo Archives: gentoo-user

From: Alex Schuster <wonko@×××××××××.org>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] LVM for data drives but not the OS
Date: Thu, 07 Apr 2011 11:31:08
Message-Id: 201104071329.03106.wonko@wonkology.org
In Reply to: [gentoo-user] LVM for data drives but not the OS by Dale
1 Dale writes:
2
3 > Quick question about LVM. I have a 750Gb drive that has miscellaneous
4 > stuff on it. Stuff likes videos, music, pictures, ISO files and a few
5 > other things. It's not full yet but it is working on it. I have my OS
6 > on sda. The large drive is on sdc. If I buy another drive it should be
7 > sdd. I think this is possible from what I have read but want to make
8 > sure. Could I put sdc and sdd on LVM but the OS remain as it is with
9 > LVM not involved at all? Basically, my OS stays just like it is and is
10 > not touched my LVM at all but the two larger drives are managed by LVM.
11 >
12 > I want to do it this way because I don't trust LVM enough to put my OS
13 > on. Just my personal opinion on LVM.
14
15 # create some partitions, or a single one. I prefer to have multiple ones,
16 just in case I want to put other stuff there, like another OS.
17 cfdisk /dev/sdd
18
19 # create physical volumes (assuming you have /dev/sdd5 to /dev/sdd8)
20 pvcreate /dev/sdd[5678]
21
22 # create volume group 'stuff', using all those partitions
23 vgcreate stuff /dev/sdd[5678]
24
25 # create logical volumes. You probably will only have a single one, but
26 here's how you would do this if you want three.
27 lvcreate -L 300G -n music stuff
28 lvcreate -L 100G -n pictures stuff
29 lvcreate -L 100G -n other stuff
30
31 # create file systems
32 for fs in music pictures other
33 do
34 mke2fs -j -m 1 -L $fs /dev/stuff/$fs
35 done
36
37 > If there is a better solution to link two large drives, I'm open to
38 > those ideas as well. LVM is all I can think of is why I mention it.
39
40 RAID would be another solution.
41 Beware, when one drive fails, all data can be lost.
42
43 # mount the filesystems, and move stuff from sdc to them
44
45 # call cfdisk and partition sdc (if you like)
46
47 # create physical volumes:
48 pvcreate /dev/sdc*
49
50 # extend volume group
51 vgextend stuff /dev/sdc*
52
53 # want to enlarge file systems?
54 lvresize -L 1000G /dev/stuff/other
55 resize2fs /dev/stuff/other
56
57 Use pvscan, lvscan and vgscan to check what physical/logical volumes and
58 volume groups you have. {pv,lv,vg}dispklay give more verbose information.
59
60 You might want to have more than one volume group. Maybe one for not so
61 important data, that spans over two disks, and one or two that reside on a
62 single drive only. So in case one drive fails, you do not lose too much
63 data. What about a volume group that stores backups of each file system on
64 sda?
65
66 Wonko