Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: 12.04 server install LVM options

  1. #1
    Join Date
    Nov 2012
    Beans
    1

    12.04 server install LVM options

    Ok.. currently looking at building a 12.04 media server. have a 250gb drive that I wanted to dedicate to the server and software. A 2 Tb drive that I'd like to grow later to 10 Tb using LVM. But reading thru the forums, I'm a little confused so I thought it was time to ask.

    The current thought process I have is to leave the 2 Tb drive disconnected and go thru the server install with a Guided Partition with no LVM. After install, install the LVM portion with the 2Tb drive installed. As I really am looking to have the 250gb drive as the OS only, as I think it would be better not to tie LVM to it incase of failure.

    Am I looking at this correctly or will LVM install on the 250gb anyhow?

  2. #2
    Join Date
    Mar 2006
    Location
    Williams Lake
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: 12.04 server install LVM options

    A bump for the move.

  3. #3
    Join Date
    Nov 2009
    Location
    Segur De Calafell, Spain
    Beans
    11,906
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: 12.04 server install LVM options

    The LVM will not install to the 250GB disk unless you tell it to. But you are still looking at this little bit incorrectly.

    Even if you have both disks present at install, and you install the OS to the 250GB disk and make a LVM on the 2TB disk, they are not "tied" together.
    If the 250GB disk fails, of course the server will not boot since the OS is there. But the data on the LVM 2TB disk is not touched at all. Connect it to another linux machine, activate the LVM and voila, you have all the data accessible.

    But you will have to use the manual partitioning option. You will make root and swap on the small disk (and any other separate partition you may want), and make one large partition on the big disk using it as physical device for LVM. After that you go into Configure LVM and set up your Volume Group and Logical Volume(s). Note, don't give the whole space to the LVs right away. Leave yourself the flexibility to make other LVs later if you choose so. You can always grow LVs size in LVM, that's the point, but shrinking is little bit more complicated.

    You can install LVM later too, if you only have the small disk connected during install. You will just have to work a bit more on the command line. If you do it during installation the installer interface might be little better for you. It depends...
    Darko.
    -----------------------------------------------------------------------
    Ubuntu 14.04 LTS 64bit & Windows 7 Ultimate 64bit

  4. #4
    Join Date
    Sep 2011
    Location
    Behind you!
    Beans
    544
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: 12.04 server install LVM options

    darkod is correct, you do not have to (and shouldn't) tie both drives as a single source in LVM. If you want to make sure you don't accidentally use the 2nd drive, having it unplugged during install will certainly do that.

    But when you install your OS, you should definitely select the manual partition option. I like to use LVM for everything (except /boot) and keep it all separated. I also like to leave room for the partitions and LVs to grow over time so I do not allocate everything to the LVM.

    To see how I do this, click the link in my sig for setting up Ubuntu Server. You would follow the partition setup for your 1st drive using that...then add your 2nd drive and mount it to /media or something.

    LHammonds

  5. #5
    Join Date
    Jul 2011
    Beans
    20

    Re: 12.04 server install LVM options

    12.04 server installation; LVM difficulties


    First of all, I apologize for shifting the topic of this thread, but I have to do that because I have less than 25 postings.


    Last week I downloaded Ubuntu 12.04 Server to create a file server on an Atom computer for our home network, but I got into trouble setting up logical volume management (LVM). When I chose LVM during the CD setup, the setup program gave this report for partition #1 (the only partition):
    LVM VG Aspire, LV root -396.8GB Linux device-mapper (linear)
    #1 396.8GB f ext4 /
    LVM VG Aspire, LV swap_1 -3.2GB Linux device-mapper (linear)
    SCSI2 (0,0,0) (sda) – 500.1GB ATA Hitachi HTS54505
    #1 primary 254.8MB f ext2 /boot
    #5 logical 499.8GB K lvm


    I completed the rest of the installation and rebooted, ran sudo apt-get update and sudo apt-get upgrade, wrote lines for /etc/hosts and /etc/network/interfaces and completed other installation commands.


    Running sudo fdisk /dev/sda, I printed this partition table (I'll ask about this later):
    Device Boot Start End Blocks Id System
    /dev/sda1 * 2048 499 711 248 832 83 Linux
    /dev/sda2 501 758 976 771 071 488 134 657 5 Extended
    /dev/sda5 501 760 976 771 071 488 134 656 8e Linux LVM


    The 12.04 Server disk set up the physical volume (PV) (/dev/sda5) (there's only one) and the volume group (VG) (Aspire) (again there's only one) for me. I believe that I set up the logical volumes correctly, running lvcreate. I used lvreduce and lvextend also to see what they would do. When I was done I ran sudo lvscan, which gave me this report, which is what I was expecting:
    active 'dev/Aspire/root' [2.00 GiB] inherit
    active 'dev/Aspire/swap_1' [3.00 GiB] inherit
    active 'dev/Aspire/usr' [10.00 GiB] inherit
    active 'dev/Aspire/home' [200.00 GiB] inherit
    active 'dev/Aspire/var' [3.00 GiB] inherit
    active 'dev/Aspire/temp' [1.00 GiB] inherit
    active 'dev/Aspire/opt' [5.00 GiB] inherit


    I used
    sudo mkfs.ext4 /dev/Aspire/home
    to create the ext4 file system for /home and similarly for the other logical volumes.


    To mount the logical volumes I added lines such as the following in /etc/fstab for for the logical volumes and directories
    /dev/Aspire/home /home ext4 noatime 0 0


    Then I rebooted and that's where my problems began . . . well, that's where they became apparent.


    I simply can't access my files. I get erratic listings for directories. Some parts of my file system seems to have gone off somewhere. I thought I could fix that problem by commenting out my changes to /etc/fstab and try again but I can't. I can get vim to open /etc/fstab but I can't get vim to save changes. Vim reports that the file is read-only no matter what I do (change permissions, which chmod won't let me do; save the file using :w!, also use :set noro; boot from the CD; boot from the hard-disk selecting a different kernel—I'm simply unable to write changes to /etc/fstab).


    I don't mind rebuilding my system from scratch again because I can do that much more quickly a second time. But I expect that I'll just make the same mistake (OK, mistakes) again and I don't know what these are.


    But here's what I think. The Ubuntu server installation CD creates the usual Linux directories. When I used the fstab assignments to mount the logical volumes, I think that I displaced the existing contents of the directories (or perhaps the file metadata). The specific directions I was using (Gentoo LVM2 Installation) had the mount points going to the /mnt directory, but that didn't make sense because then I'd have two sets of directories with the same name and more importantly, critical files wouldn't be where they're expected to be. (I used the Gentoo directions because they are clearer than Ubuntu's.)


    I read quite a bit before proceeding with LVM. Most of what I read was about pv-, vg-, and lv- create, reduce, and extend, with a little bit about pv-, vg-, or lv- scan. I really didn't understand the mounting. I use mounting with NFS successfully, but there I'm creating a new directory with a new name showing files on another host whereas the Gentoo directions seem to imply identical files on two different directories.


    The Gentoo instructions also mentioned compiling and installing the LVM module and reinstalling the initial RAM file system if one is placing /usr and /var on a logical volume. Are module compiling and an initial RAM file system reconfiguration required for LVM on Ubuntu?


    I'm concerned too by the fdisk /dev/sda report that I listed earlier in this posting
    /dev/sda2 501 758 976 771 071 488 134 657 5 Extended
    /dev/sda5 501 760 976 771 071 488 134 656 8e Linux LVM
    which has almost the same disk allocation given to both sda2 (Extended) and sda5 (Linux LVM). I don't see why this is done and am wondering if this also is a problem.


    Whether you can help me or not, I thank you for reading this far. I'm grateful for your consideration.

  6. #6
    Join Date
    Nov 2009
    Location
    Segur De Calafell, Spain
    Beans
    11,906
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: 12.04 server install LVM options

    @abriano
    I don't think your problem is with LVM but with how you tried to move Home.

    And if Home is not opened correctly, logging in and using the system is not running correctly. Also, you have to be careful when adding additional mount points once the system is installed. If in the default installation you installed with only one LV, the root LV, then it has folder for /home, /usr, etc. After adding the new LVs and entries in fstab, I think the old folders will clash with the new ones. You can't have both.

    Also, when copying, what did you use? Especially when copying /home because it needs to keep ownership and permissions intact. For example, I use cp -ax which keeps them. And you should do the copy and mount points adjustments from live mode. Boot the system with the live cd, add the lvm2 package, activate the LVM and do what you want to do. Live mode will also allow you to edit /etc/fstab using sudo.

    From another point of view, if you don't mind doing a new install, that might be a better and faster option. But this time create all LVs that you want to have right away in the installation, not later.
    Darko.
    -----------------------------------------------------------------------
    Ubuntu 14.04 LTS 64bit & Windows 7 Ultimate 64bit

  7. #7
    Join Date
    Jul 2010
    Location
    Michigan, USA
    Beans
    2,123
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: 12.04 server install LVM options

    In regards to the OP, for a home media server, I would really suggest taking a look at SnapRAID. It's very easy to setup (and add more disks to later). It will provide you some redundancy for your data while still allowing each disk to be individually readable. Also, disks can be spun down to save power, and only 1 disk has to be spun up to playback a file as opposed to the entire RAID array as with traditional RAID setups. Here's how I set it up at home.
    Last edited by rubylaser; March 13th, 2013 at 05:03 PM.

  8. #8
    Join Date
    Jul 2011
    Beans
    20

    Re: 12.04 server install LVM options

    Thank you for your replies, darkod and rubylaser,

    I will indeed do a new installation because I think it will be quicker and more direct,

    When I was doing the installation from the 12.04 Server CD, there seemed to be nothing in that process to set up the logical valumes (the physical volumes and volume groups, yes, but not the logical volumes). But I suspect now that I missed that step.

    Thanks for the suggestion, rubylaser, which I will look at in the future. For now I'm limited by my single-board Atom computer, which only permits one disk drive.

    It will be a few days before I'm able to address these points, but I should be able to reply by early next week.

    abriano

  9. #9
    Join Date
    Nov 2009
    Location
    Segur De Calafell, Spain
    Beans
    11,906
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: 12.04 server install LVM options

    When you go into the Configure LVM option, I think it first asks you which physical partition you want to use for LVM, after that to create at least one VG and after that to create the LVs. You can create more than one, simply create as many as you want and only after you are done go to the Finish option which brings you back to the partitions list.

    All LVs you created should exist as devices in the partitions list, so you can select them one by one and for each select the filesystem you want to use and the mount point. But I am talking about the manual install.

    If you select the auto method to install with LVM, it creates only root and swap LVs. For more specific options, you need to use the manual install (partitioning).
    Darko.
    -----------------------------------------------------------------------
    Ubuntu 14.04 LTS 64bit & Windows 7 Ultimate 64bit

  10. #10
    Join Date
    Jul 2011
    Beans
    20

    Re: 12.04 server install LVM options

    Re: 12.04 server installation; LVM difficulties - RESOLVED


    With the impetus of your message, Darko, I reinstalled Ubuntu Server 12.04.


    I missed A LOT in my first installation.


    My first mistake was not deleting my existing partitions (using fdisk /etc/sda). This time I did that and then set up partition 1 as Linux (83) for booting, and partition 2 as Linux LVM (8e) for everything else. I assigned 1 GB for partition 1 and 400 GB for partition 2. With a 500 GB disk I had about 100 GB left free. I didn't needed extended partition 5. (/boot should be on a primary, non-LVM partition.)


    Once into the 12.04 Server installation, my second and probably most crucial mistake was in choosing
    Guided LVM installation (I may not have the exact words)
    when I should have selected
    Manual
    (I would advise anyone wanting LVM for /, /root, /var, /usr, /temp and the like to use the Manual LVM installation.)


    I messed around for several hours in the manual LVM setup. Once one knows how, it's easy to use but it is not intuitive. Fortunately, the installation CD wouldn't let me go on until I got everything right. After selecting the physical volume (PV), naming the volume group (VG), and creating the logical volumes (LVs), I needed to assign the logical volumes to their directories (i.e., mount them). I found that I had to select the second line of the two line identification for each logical volume in the setup. For example root is listed as
    LVM VG VG_Apire, LV LV_root – 2.0 GB Linux device-mapper (linear)
    #1 2.0 GB
    In order to select the file system and assign the logical volume to a directory, I had to select the #1 2.0 GB line and not the preceding, descriptive line! (It's the easy stuff that does me in!) After making that selection, a window opens that allowed me to assign the directory to the logical volume and to assign the file system for the volume. (I chose ext4 for everything except /boot, which I made ext2 (and, of course, swap for /swap).


    I probably had the read-only problem with vi because I wasn't working as root—though the shell showed that I was working as root. So I'm not completely sure what happened there.


    And, to answer my own questions, I don't need to compile and install an LVM module nor do I need to reinstall the initial RAM file system The installation program does all that. (My concern probably came from the Gentoo instructions; Gentoo'ers like to work from source code.)


    And, of course, I didn't have to use the pv-, vg-, and lv- create, reduce, and extend commands. But at least now I know how to use them.


    So my problem is resolved. Again, I apolgize to the thread originator for hitch-hiking on his thread.


    And I thank my responders.


    Abriano
    Edmonton, Canada

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •