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

Re: Moving /var to another drive



And what happens if the /var/log and /var/run dirs that can change during
the tar ?

	François


On Tue, 12 Mar 2002 15:33:55 +0200 (EET)
George Karaolides <george.karaolides@linustech.com.cy> wrote:

> 
> Hi Andrew,
> 
> You need to be root on your machine to do this.
> 
> Make two partitions on the new drive using
> 
> cfdisk /dev/<drive>
> 
> Then make a filesystem on each partition.  Stick to the tried-and-tested
> ext2, or go for one of the new journalling ones like ext3 or reiserfs, if
> you're running a kernel recent enough to support them or can compile one
> that does.
> 
> E.g. mke2fs /dev/<partition>
> 
> Then mount the first partition e.g. under /mnt
> 
> mount /dev/<partition> /mnt
> 
> And transfer the data using tar:
> 
> tar cplf - -C / var | tar xvf - -C /mnt
> 
> Unmount the partition
> 
> umount /mnt
> 
> Mount the other one and do the same thing for /usr:
> 
> mount /dev/<partition>
> tar cplf - -C / usr | tar xvf - -C /mnt
> umount /mnt
> 
> Make sure you type the tar commands exactly as above, you don't want to go
> dropping the entire copnmtents of /var or /usr (or even / if you v=get it
> wrong) in the wrong place!
> 
> Edit /etc/fstab and either add lines for /usr and /var, or change existing
> ones, to mount your new filesystems instead of the old ones.  Here's an
> example:
> 
> --- fstab excerpt ---
> 
> /dev/sdb6 /usr ext2 rw			0	2
> /dev/sdb7 /var ext2 rw			0	2
> 
> --- end fstab excerpt ---
> 
> Then go to single user mode:
> 
> telinit S
> 
> Unmount /usr and /var:
> 
> umount /usr
> umount /var
> 
> Mount all partitions using your new fstab:
> 
> mount -a
> 
> Check that everything is mounted where it should be:
> 
> mount
> 
> And go back to your usual runlevel (usually 2 on Debian):
> 
> telinit 2
> 
> That's it.  Note that if /usr and /var were originally part of your root
> filesystem, the data will still be there but the new filesystem will be
> mounted on the top level directory so you won't see it.  After you've
> successfully transferred /usr and /var out of the root filesystem, you can
> reclaim the space by going to single user mode, unmounting /usr and /var,
> and doing the following:
> 
> rm -rvf /var
> rm -rvf /usr
> mkdir /var
> mkdir /usr
> 
> Be VERY careful that /usr and /var are NOT mounted when you do this!
> Also note, a space or a slash in the wrong place in either of the above
> commands can wreck your system completely!
> 
> Good luck,
> 
> |   George Karaolides                      Linustech Advanced Solutions,  |
> |   tel:   +357 22 55 61 29              86 Ifigenias Street, 3rd Floor,  |
> |   web:   www.linustech.com.cy              Strovolos, Nicosia CY 2003,  |
> |   email: george.karaolides@linustech.com.cy       Republic  of Cyprus.  |
> 
> On Tue, 12 Mar 2002, Andrew Stephen wrote:
> 
> > Hi
> >
> > My /var and /usr partitions have just run out of space and I was wondering
> > what is the best way to copy them to a new drive that has just been
> > installed.
> >
> > Any suggestions would be greatly appreciated.
> >
> > Regards,
> > Andrew
> >
> >
> >
> > --
> > To UNSUBSCRIBE, email to debian-user-request@lists.debian.org
> > with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> >
> >
> >
> 
> 
> -- 
> To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> 
> 



Reply to: