[linux-lvm] naive questions
Thomas Krichel
krichel at openlib.org
Sat Jan 26 09:23:56 UTC 2008
François Patte writes
> I would like to change my linux install and I need to modify /home which
> is now like this:
>
> __________________________|__________
> sdc1 sdb2 = 4126 extends
>
> If I reduce /home by 4127 extends may I be sure that /home will now stay
> on sdc1 only?
>
I am not an expert.
Here is a set of instructions how to do it, step-by-step.
I have used them in the past. The aim, I understand is
to set up a logical volume for /home, that contains
no other disk than sdc1. Let /dev/sdc1 be 100
gibabytes large, for illustration
1. check your volume. Say, it's called vg1-lv1, and
say it's ext2 or ext3
e2fsck -f -y /dev/mapper/vg1-lv1
2. resize the file system
resize2fs -pf /dev/mapper/vg1-lv1 100G
where 100 is the size of home, assumed here.
That resizes the file system with ext, of course,
if you use another file system type there will be
another command.
3. reduce the logical volume
lvreduce -L 100G /dev/vg1/lv1
4. Now look at
pvdisplay
5. If sdb2 is 0% used, go to step 6, else run
pvmove /dev/sdb2
6 you can now reduce the disk from the volume.
vgreduce vg1 /dev/sdb2
> Was it possible to be aware of this before discoring it after
> install?
I guess this is an issue of the O/S you are using.
> What happens if sdb disk crashes? Shall I loose all my data in
> /home?
Not necessarily. If you find that /dev/sdb2 is getting
bad, you get read/write errors, or you perform a
badblock check on it, say, you can recover by
reducing as described about. I have done this
several times with good results.
The big problem occurs of the first disk /dev/sdc1
is in a bad shape such that you can not get to
the filesystem anymore. This is what happened
to me. I still have not fixed my problem, compounded
by the fact that this accident occured shortly
after I erased my backup by mistake.
Unless you are a real disk expert, and you know lvm
very well, I would only use lvm for building
large disks to hold backup, and only when you
are sure you are having two backups.
Bonne chance!
Thomas Krichel http://openlib.org/home/krichel
RePEc:per:1965-06-05:thomas_krichel
phone: +7 383 330 6813 skype: thomaskrichel
More information about the linux-lvm
mailing list