Re: moving the /var partition

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Peter

Chris Purcell wrote:
I would boot into rescue (or single user) mode and use find/cpio to
copy /var/ to /user/.

find /var -xdev | cpio -pmduv /user

I don't think this worked. I *know* my cp -prx blah blah didn't work. I get several errors when I reboot:

chmod: failed to get attributes of '/var/log/wtmp': No such file or
directory.

I am guessing these files were not copied or created properly in the
/user filesystem.


...and then just rename them and modify your fstab file.

mv /var /var.old
mv /user /var
mv /var.old /user

Chris




I also tried used parted to copy the filesystem, but parted didn't work. I'm guessing it was expecting an ext2 filesystem, when it was actually an ext3 filesystem. I was also hoping to use parted to reduce what will be a 60GB /var partition to something more managable. No joy there either.

Does parted not work with ext3?

Bill


I don't know about parted because I've never used it. In the fstab file,
did you specify the correct filesystem (ext3) and partition numbers (or
labels)? If you followed the directions above, /var should be your new
partition that you just created, and /user is now your old var partition. Correct?? If so, run some basic commands against /var and /user to see
that everything matches. Run 'ls -lh', 'du -sh', and other various
commands to see if you notice any differences in the partitions. Look at
file sizes, ownership, and things like that.


Chris






-- Peter B. West <http://www.powerup.com.au/~pbwest/resume.html>


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

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux