Moving /var to another LVM: Keep quotas?

Discussion in 'Installation/Configuration' started by ande, Jan 8, 2013.

  1. ande

    ande Member HowtoForge Supporter

    Hi there,

    I have four LVMs on top of a RAID 1, like this:

    Code:
    Dateisystem          1K‐Blöcke   Benutzt Verfügbar Ben% Eingehängt auf
    /dev/mapper/vg0-root  31209468  20995024   8641580  71% /
    tmpfs                  4095408         0   4095408   0% /lib/init/rw
    udev                   4089952       176   4089776   1% /dev
    tmpfs                  4095408         0   4095408   0% /dev/shm
    /dev/md0                254699     20116    221431   9% /boot
    /dev/mapper/vg0-lv1  104031520    192248  98596392   1% /lv1
    /dev/mapper/vg0-lv2  104031520    192248  98596392   1% /lv2
    /dev/mapper/vg0-lv3  486220392   8893844 452822436   2% /lv3
    
    As / is getting filled up and I need more space in the future, I'd like to move /var to /lv1.

    I thought I'll boot into my rescue system, mount / and /lv1, them move the contents of folder /var into /lv1 (currently empty) - and then I'd need the right /ec/fstab changes in order to make the quota functioning again.

    I'm not sure about the mount options - plus it's a production server...

    All the lv's are on top of a RAID1 /dev/md1

    Any hints?

    Added question: Will the links be preserved when I move stuff? Options for moving? rsync -a ?
     
    Last edited: Jan 8, 2013
  2. falko

    falko Super Moderator Howtoforge Staff

    When you are in the rescue system, copy everything from /var 7o /lv1:

    Code:
    cp -pfr /var/* /lv1/
    Rename /var to something else and /lv1 to /var:
    Code:
    mv /var /var_orig
    mv /lv1 /var
    Then adjust your /etc/fstab. Mount options should probably be the same as for /.
     
  3. ande

    ande Member HowtoForge Supporter

    Danke erst mal. Soweit alles verstanden, aber wenn ich im Rescue-System (Hetzner) im / - Filesystem den Ordner /lv1 in (das neue) /var umbenenne, dann hat doch das LVM-System noch nicht verstanden, dass es jetzt nicht auf /lv1 sondern auf /var mounten soll?

    Wie vermeide ich da Unsinn?

    Danke schon mal...
     
  4. falko

    falko Super Moderator Howtoforge Staff

    English, please!

    It doesn't matter to LVM where you mount a volume.
     
  5. ande

    ande Member HowtoForge Supporter

    Oh, I'm sorry for switching into German... :)

    Thanks, I see.. I overlooked that the mounting command for the logical volume is in /etc/fstab, too.. my bad.

    Thanks for answering!
     

Share This Page