LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   What does it happen if i remove drives after i unmount LVM (https://www.linuxquestions.org/questions/linux-newbie-8/what-does-it-happen-if-i-remove-drives-after-i-unmount-lvm-854443/)

silvyus_06 01-05-2011 03:44 PM

What does it happen if i remove drives after i unmount LVM
 
Ok.

Last night, i was thinking that i'm running out of space on my computer . So i wanted to setup LVM.

I set it up using this LVM guide (which seemed the one that made most sense to me )
I learned that i need to pvcreate /dev/sdX with every device i want .
Then vgcreate and put like : vgcreate name /dev/sdb1 /dev/sdb2
then lvcreate -n name1 --size Xg name
So then i make a file system on it and mount it . My question is :
If i remove a USB flash drive while having unmounted /dev/name/name1 will it harm my LVM setup or something ... i mean , i need space on my laptop , but i also need like 1GB on my usb to take it at school just in case i need to make a presentation or something . ( + that i need a ubuntu live usb on it just in case :) )

And also , if i want to make my already /home partition that i have larger using lvm , is it possible ?

crts 01-05-2011 04:43 PM

Hi,

first of all, if you intent to use lvm and store your precious data on it then read a 'real' guide first:
http://tldp.org/HOWTO/LVM-HOWTO/

Afterwards play around with it a bit to get familiar with it. Use lvm2.

Now to your main question:
Quote:

If i remove a USB flash drive while having unmounted /dev/name/name1 will it harm my LVM setup or something
I also do have an external USB hdd which is formatted as lvm. As long as you unmount it and shutdown lvm properly before you unplug it I don't see any problems.
Quote:

And also , if i want to make my already /home partition that i have larger using lvm , is it possible ?
That depends. Is your /home directory already lvm? I suppose not. In that case you will have to back it up first since creating an lvm will destroy all data on it. After lvm is created you will have to format it anyways. Since space is tight, as you said, I assume that the rest of the space is taken up by your / partition, i.e. there is no unallocated space left on the hdd. In this case you will either have to also reinstall using lvm for your root partition, too. LVM will give you some flexibility in changing the size of your logical devices. However, you might want to consider the classical approach of shrinking one partition and growing the other one afterwards.
Code:

man resize2fs

silvyus_06 01-05-2011 05:02 PM

thanks for the reply . well ... at least now it's clear that it won't happen anything bad . i will read how to "properly" shutdown lvm but any hints here would help lots.

my /home partition is almost full . i can back it up with partimage (had a thread on this :) ) and will compress it to the maximum .. maybe i can get it sized down to like 4GB to fit on a dvd ... (using like 14 GB on /home right now and it's sizze is 16GB )

the last time i tried the classical approach to make space for a lvm on my usb drive for testing purposes it deleted everything on that FAT32 partition ...

and on my harddisk , i have a corrupt ntfs , which is full of valuable data and is the biggest on my pc . i can't resize it because gparted doesn't let me .. and there's no command that would handle it either .. had a thread on this also ..

anyways this thread is almost solved.

crts 01-05-2011 05:25 PM

Quote:

i will read how to "properly" shutdown lvm but any hints here would help lots.
Well, it is not that complicated. For me it was always sufficient to issue these two commands:
Code:

sudo umount /path/to/vol01_mountpoint
sudo umount /path/to/vol02_mountpoint
sudo umount /path/to/vol03_mountpoint
...

sudo vgchange -a n vol_group

I you have only one volume group active on your whole system you can shorten the last command to
Code:

sudo vgchange -a n
This will shutdown every volume group.

silvyus_06 01-05-2011 08:43 PM

thanks .


All times are GMT -5. The time now is 02:39 PM.