LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Renaming / Chaging Filesystems (https://www.linuxquestions.org/questions/linux-newbie-8/renaming-chaging-filesystems-696138/)

swamprat 01-09-2009 01:18 PM

Renaming / Chaging Filesystems
 
I ran out of space in my /var parition.

I created a new partition called /varnew and is is in the fstab file.

I copied everything from /var into the /varnew filesystem.

Now I would like to get rid of /var and rename /varnew to /var.

I'm a newbie and don't know how to go about resolving this issue.

Any help and some detailed instructions would be greatly appreciated.

Thanks

Suse 11.0

qlockheed 01-09-2009 01:28 PM

How did you "copy"? Linking structure and ownership etc under /var is very important.

swamprat 01-09-2009 04:36 PM

Thanks for your reply.

I copied from /var to /varnew with the cp command preserving all the attribuites.

swamprat 01-10-2009 05:58 PM

Just wondering if anyone has any idea how to resolve this issue/

alan_ri 01-10-2009 06:50 PM

First you could see what is using /var in one way or the other with;
Code:

lsof +D /var/
then you will need to kill those processes.Do this in the run level 1.Name your new partition /var but mount it when you have copied everything from the old /var.Your new partition should be mounted in a /whatever and you should copy contest of the old /var there.Then unmount old /var and /whatever and mount new /var.

Or you could create a symlink to free space with;
Quote:

ln -s /var /varnew
then old /var will be on the /varnew.

syg00 01-10-2009 06:52 PM

Do it from a liveCD. You'll be missing some logs, so it might be worthwhile doing the copy again (also from the liveCD) to ensure you have everthing. Clean up fstab while you're at it.
As you say it's a separate partition, you can clean up the old anytime after that.

Junior Hacker 01-10-2009 07:51 PM

In this thread I show how to do similar with /home.

swamprat 01-11-2009 04:48 PM

Thanks Junior Hacker.

I followed the post you suggested and it it worked up to #7.
I was logged in and did an 'su' to get into root.
When I tried to execute the 'rm' command as in #7 I got the following:
rm: cannot remove diectory '/var': Device or resource busy.

I rebooted and went to failsafe move, retried the command in runmode 5 and it didn't work there so I tried runmode 1 and that also didn't work. I did a 'ps -ef' and even in failsafe mode I see a whole lot of processes running and I'm sure that some are accessing the /var filesystem.

Is there anyway around this?

How can I boot into runmode 1? Would that resolve the issue and not start up these processes at boot time?

Using Suse 11.0

As root or sudo, or single user mode:
1: #mkdir /mnt/newhome
2: #fdisk -l (to find device name of partition)
3: #mount -t ext3 /dev/???? /mnt/newhome (replace check marks in /dev/xxxx as per output of fdisk -l command)
4: #cd /home
5: #cp -ax * /mnt/newhome
6: #cd /
7: #rm -fr /home
8: #umount /mnt/newhome
9: #mv /mnt/newhome /home
10: #vim /etc/fstab (edit /etc/fstab with favorite editor if not vim, and add line below with proper /dev/xxxx)
11: /dev/???? /home ext3 defaults 1 2
12: re-boot

Junior Hacker 01-11-2009 06:21 PM

Maybe the drives/partitions need to be unmounted to move /var, which means you might want to try from another running Linux or live CD that will allow writing to a drive.


All times are GMT -5. The time now is 04:55 AM.