Re: Creating/Moving a partition
> "David J. Kanter" wrote:
> >
> > I'd like to make a new partition for /var because I don't have enough drive
> > space where /var is currently mounted (/) to run apt-get dist-upgrade.
> > What's the best way of doing this? I can create a new /var partition becaus
e
> > I've got plenty of available drive space, but what set-up files will I have
> > to modify to make sure things go smoothly?
> >
> > I assume I'll have to change fstab. But then do I have to move all contents
> > of the current /var to the new /var? Could I create the new partition using
> > a temporary name, move all the /var stuff to it, then rename it to /var?
>
> Thats what I would suggest.
> Stop everything you can, copy the contents and do the final swapover in one
> line, just in case
> # mv /var /old_var ; mv /new_var /var
NO, NO, NO, NO, NO!!!!
Do *NOT* use "mv". This will change the ownership and protection rights
of the contents. This will most certainly break something.
Instead, use "cp -a" to preserve everything.
1. Log in as "root"
2. Go to run level 1 (kills networking). Also kill all user processes.
init 1
3. Add the following to your /etc/fstab
/dev/??? /var ext2 defaults 1 2
(The ??? is the partition of your new /var)
4. Change the name of your old /var directory and make a new empty one.
mv /var /oldvar
mkdir /var
chmod 755 /var
5. Mount your new var partition.
mount /dev/??? /var
6. Now, use "cp -a" (or "cp -av" if you want to watch it) to copy your
files, permissions and ownership to the new partition.
cp -av /var/* /var
If things don't work, you still have your old partition in pristine shape
to go back to where you were. I wouldn't delete the old /var until I
determined that everything works fine--maybe a week.
The idea of just getting a bigger root partition is a bad idea. /var is
a very, very good candidate for a separate partition.
Reply to: