Nux!


Home » Stella » Report a problem or request a feature » LVM : powerful but tough
LVM : powerful but tough [message #1473] Sun, 22 September 2013 08:22 Go to next message
MrNice is currently offline  MrNice
Messages: 108
Registered: December 2012
Location: Ireland
Senior Member
Hi,

This is not a Stella problem nor a request but as we have here some very skilled admin, I expose my problem and I think they will answer in a way I will understand. All the threads in Internet regarding LVM are confusing and I spent more than 2 days struggling with it without great success.

I am new with LVM but I have read different manuals to try to understand.

Let's get to the point:
I have a laptop with Stella installed in a 500G HDD, 2 partitions sda1 = /boot, sda2 = LVM.
My data are only 50G max and I need this HDD for another use, I want to change the HDD for a 120G.

Stella was installed in a 465G VG and my only success is to have reduced the LV named /dev/vg_nice/LogVol03 and the physical associated from more than 300G to 90G.
However, the VG is still 465G and I can't reduce it, I don't know if it's possible.

What are now the steps to copy this HDD to the small one? ?

Many thanks for your help. I think this will be helpful for many people.

# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_nice-lv_root
                      7.7G  3.8G  3.9G  50% /
tmpfs                 375M   76K  375M   1% /dev/shm
/dev/mapper/vg_nice-LogVol03
                       89G   34G   51G  41% /Store
/dev/sda1             485M  115M  345M  26% /boot
/dev/mapper/vg_nice-lv_home
                      3.9G  568M  3.1G  16% /home


# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               vg_nice
  PV Size               465.27 GiB / not usable 3.00 MiB
  Allocatable           yes 
  PE Size               4.00 MiB
  Total PE              119109
  Free PE               92693
  Allocated PE          26416
  PV UUID               QD2OJK-KQZ0-nUrA-e0zo-TQpV-iQ59-KLT26x


# vgdisplay
  --- Volume group ---
  VG Name               vg_nice
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  9
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                4
  Open LV               4
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               465.27 GiB
  PE Size               4.00 MiB
  Total PE              119109
  Alloc PE / Size       26416 / 103.19 GiB
  Free  PE / Size       92693 / 362.08 GiB
  VG UUID               330ZQ2-mpuV-T3x7-l41Q-uy2K-EX0h-98nfXS
   

# lvdisplay
  --- Logical volume ---
  LV Path                /dev/vg_nice/lv_root
  LV Name                lv_root
  VG Name                vg_nice
  LV UUID                iE6suG-jfip-zEW5-GLNO-1buv-COlh-BEv3Gv
  LV Write Access        read/write
  LV Creation host, time nice, 2013-05-30 17:11:44 +0100
  LV Status              available
  # open                 1
  LV Size                7.81 GiB
  Current LE             2000
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0
   
  --- Logical volume ---
  LV Path                /dev/vg_nice/lv_swap
  LV Name                lv_swap
  VG Name                vg_nice
  LV UUID                Yffsjh-5pPx-4glW-92UH-Tu1I-Yt7t-Uc6YGz
  LV Write Access        read/write
  LV Creation host, time nice, 2013-05-30 17:11:50 +0100
  LV Status              available
  # open                 1
  LV Size                1.47 GiB
  Current LE             376
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1
   
  --- Logical volume ---
  LV Path                /dev/vg_nice/LogVol03
  LV Name                LogVol03
  VG Name                vg_nice
  LV UUID                nNH494-s0MZ-2kTH-0fGQ-YK9Z-RKFd-tAoR70
  LV Write Access        read/write
  LV Creation host, time nice, 2013-05-30 17:11:51 +0100
  LV Status              available
  # open                 1
  LV Size                90.00 GiB
  Current LE             23040
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2
   
  --- Logical volume ---
  LV Path                /dev/vg_nice/lv_home
  LV Name                lv_home
  VG Name                vg_nice
  LV UUID                H6pVAT-FtSk-Ourb-6v1F-fdD2-yP38-FU0i0S
  LV Write Access        read/write
  LV Creation host, time nice, 2013-05-30 17:14:16 +0100
  LV Status              available
  # open                 1
  LV Size                3.91 GiB
  Current LE             1000
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:3




Re: LVM : powerful but tough [message #1474 is a reply to message #1473] Sun, 22 September 2013 11:58 Go to previous messageGo to next message
nux is currently offline  nux
Messages: 1659
Registered: January 2012
Senior Member
Administrator

Hi,

This looks rather convoluted, to be honest what I would do is install fresh on the new disk (is that an SSD?) and then copy my data over.
If you don't have software custom installed then you can do a `rpm -qa` to dump the list of installed packages and have them installed on the new OS, recreate your users and copy over the home dirs.

Having said that, what you can also do is install fresh on the new drive, partition however you want - I suggest keeping it simple, maybe just one partition - then simply copy/paste all the files[1] from the old drive to the new. At the end make sure /boot/grub/menu.lst and /etc/fstab are using the right partitions, you will likely need to adjust these.
Re: LVM : powerful but tough [message #1475 is a reply to message #1474] Sun, 22 September 2013 15:13 Go to previous messageGo to next message
MrNice is currently offline  MrNice
Messages: 108
Registered: December 2012
Location: Ireland
Senior Member
Nux,

It's look like there is no tool for what I want. Maybe in the future.

1 - Do you think the best way to install Stella for a home use is NOT to use LVM? With this experience I'd say NOT use it.

2 - "rpm -qa" spits a dozen of pages full of package names. Is there a way to install them automatically from a file or at least to sort out them "what is installed from Stella" and what I have to install after. Maybe compare 2 files?

3 - Usually I create the separate partitions: /boot, /, /home, /swap, /Store
After a new install with all the previous packages, I will copy /home from old to new; do I need to use dd or a simple copy/past is good? Is there any other config file in the / directory?

Many thanks. Have a good sunny (at least in Galway) Sunday.
Re: LVM : powerful but tough [message #1476 is a reply to message #1473] Sun, 22 September 2013 17:32 Go to previous messageGo to next message
nux is currently offline  nux
Messages: 1659
Registered: January 2012
Senior Member
Administrator

Hi,

Well, imo:

1. When I switched to a 120GB SSD I only made one partition and mounted it as /. I do not even have a swap (that one can be provided via a file anyway[1]). The drive is already small, no point slicing it up and wasting space. For recovery I use online backups, my broadband allows fast transfers (20 Mbps up @ BT infinity); I also have an external usb drive that I backup stuff to every now and then.
So, in short, I'd leave LVM out, for simplicity's sake.

2. You can do something like:
rpm -qa > /root/packages.txt

save that file somewhere and transfer it on the new system and there do something like:
yum -y install $(cat /root/packages.txt)


HTH

Regards from cloudy (but warm) London. I should visit Ireland soon. Smile

[1] - http://www.nux.ro/archive/2013/05/Swap_on_a_file.html

[Updated on: Sun, 22 September 2013 17:32]

Report message to a moderator

Re: LVM : powerful but tough [message #1477 is a reply to message #1476] Tue, 24 September 2013 07:49 Go to previous messageGo to next message
MrNice is currently offline  MrNice
Messages: 108
Registered: December 2012
Location: Ireland
Senior Member
Thanks nux for your tips.

I'll go for the simplest
Re: LVM : powerful but tough [message #1478 is a reply to message #1473] Tue, 24 September 2013 11:50 Go to previous message
nux is currently offline  nux
Messages: 1659
Registered: January 2012
Senior Member
Administrator

You're welcome.

And looks like in my previous reply I forgot to answer point3 so: you can simply copy paste the home dirs, just make sure they are owner by the proper UID in the end, i.e. run chown -R user:user /home/user.

Previous Topic: sandy bridge gpu acceleration confusion
Next Topic: transaction error updating gstreamer
Goto Forum:
  


Current Time: Sat Aug 24 10:37:48 BST 2019

Total time taken to generate the page: 0.03515 seconds