Re: moving the /var partition [SOLVED]

From: Bill Tangren (bjt_at_aa.usno.navy.mil)
Date: 10/23/03

  • Next message: Reuben D. Budiardja: "Re: Transfering files in SSH"
    To: redhat-list@redhat.com
    Date: Thu, 23 Oct 2003 16:50:07 -0400
    
    

    Peter B. West wrote:
    > Bill,
    >
    > This is getting a bit confused. You say you have just installed a new
    > disk, yet you also say you want to reduce a 60Gb /var partition. If you
    > are installing a new disk, you can decide at the outset how big a /var
    > partition you want. I would go back to the beginning, decide how big I
    > wanted my var to be, and partition the new disk accordingly. Decide
    > what you want ot do with the rest of the disk, e.g., /opt, /usr2 or
    > whatever. Partition accordingly. Whatever tool you use will tell you
    > the /dev/hd? name of your new partitions. Build your filesystem(s) on
    > the new disk. Then follow the instructions abotu temporary mounts.
    >
    > I would enter the values for the temporary mount in /etc/fstab, making
    > sure to create the mount point for your temporary var - say /mnt/var. If
    > these things match you will be able to issue
    > # mount /mnt/var
    >
    > Do the copy using cpio or cp. If using cp I would try -ax (i.e. -dpRx).
    > If using cpio, I would probably add --sparse to the args, just in case
    > it saves some space.
    >
    > Now modify the /etc/fstab. Where is your current /usr? Is it a
    > directory on the / partition? /usr is a critical partition istself. As
    > you have a new disk, I would *first* bring the /var partition up in its
    > new home, then sort /usr out. In either case, don't touch /usr to start
    > with. It sounds as though /var is currently a partition. Change the
    > /var mount point to the newly created partition, and change the current
    > /var partition to mount on /mnt/var. Reboot. If all goes well, this
    > process will be transparent.
    >
    > Then do something similar for your current /usr. Delete the contents of
    > /mnt/var. (Be careful where you are. You might be better to create a
    > /mnt/newusr directory, and in the previous step, change the old /var
    > partition mount point to /mnt/newusr, just so that the names don't get
    > confused.) Do the copy of the current contents of /usr to the old var
    > partition as you have mounted it. Change /etc/fstab to mount the old
    > var partition as /usr. Reboot.
    >
    > As suggested, I would use the device names for all of this, (/dev/hdb1,
    > etc), and sort out the labels later.
    >
    > Incidentally, f wither /var or /usr is currently a directory in the /
    > file system, rather than a mounted partition, you will have to arrange
    > to delete the old contents of the directory when everything is working.
    > The best way to do that would be to boot in rescue mode, and delete the
    > directory contents from /mnt/sysimage, after making sure you didn't have
    > the new partitions mounted there. I don't know how rescue treats
    > mounted partitons, but I assume they are mounted at the approproate
    > points under /mnt/sysimage.
    >
    > Peter
    >

    Sorry about the confusion. I was trying to solve several problems at
    once, and should not have mentioned them all in one email.

    This is what I did to solve my problem:

    On a test machine, I installed the new hd, then used fdisk to partition
    it. I ran into problems, I think because I said one partition was
    extended, and not primary. Anyhow, I put two primary partitions on the
    disk, then used

    # mke2fs -jc /dev/hdb1
    # mke2fs -jc /dev/hdb2

    to put an ext3 file system on the partitions. Having forgot to label
    them, I used

    # tune2fs -L /var /dev/hdb1
    # tune2fs -L /usr /dev/hdb2

    I then mounted them and used

    # rsync -e ssh -avz doggett:/var/ /mnt/var
    # rsync -e ssh -avz doggett:/usr/ /mnt/usr

    to get the data off the old partitions. I then altered the /etc/fstab on
    the production machine. Next, I shut down both machines, swaped disks,
    and restarted them.

    Worked like a charm.

    THANKS to everyone for their help. One of the key piece of information I
    didn't have was that tune2fs can be used on ext3 file systems. The man
    pages didn't state that.

    Thanks again,

    Bill

    -- 
    redhat-list mailing list
    unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe
    https://www.redhat.com/mailman/listinfo/redhat-list
    

  • Next message: Reuben D. Budiardja: "Re: Transfering files in SSH"

    Relevant Pages

    • Re: Wasted 8 megs?
      ... basic disk to a dynamic disk. ... Unpartitioned Space Remains When Creating a Partition During ... If you're installing to a clean hard drive, you should see a screen similar to this right after you accept the EULA. ... You'll miss the following screens. ...
      (microsoft.public.windowsxp.general)
    • Re: Wasted 8 megs?
      ... basic disk to a dynamic disk. ... Unpartitioned Space Remains When Creating a Partition During ... If you're installing to a clean hard drive, ... the following screens. ...
      (microsoft.public.windowsxp.general)
    • Re: Linux community software-update-anarchy polemic
      ... Remember, I'm just a monkey. ... That implies that if you have one disk per partition, ... Trust the kernel or don't trust the kernel, but either way, both ...
      (comp.os.linux.misc)
    • Re: Seagate 400GB drive reduced to 128GB after WinXP reinstall
      ... created a new partition in the available space with no problems. ... Even after installing SP2, I could not get the full capacity of the drive ... my XP original disk, installing this on a newly NTFS partitioned 80GB ... changing the positions of the drives to no avail). ...
      (microsoft.public.windowsxp.hardware)
    • SUMMARY: Moving /usr From Under Root "/" To Its Own Partition
      ... One of the reasons for doing this is to end up with a smaller root ... Install the boot block and boot off the new drive. ... " In order for the root partition to be fscked and remounted ... D> temporarily on the existing disk. ...
      (SunManagers)