You are not logged in.

#1 2010-02-06 23:32:43

Tleilaxu
Member
From: Plymouth, England
Registered: 2010-02-06
Posts: 9

Relocating /var/ from a separate partition

Hello,

I bought a new 500gb hard drive as a backup for uni, but then decided to install arch on it (and leave 200 gig or so for the backup, as I really don't need more). I made four partitions: root, swap, home, and because I do quite a bit of developing and stuff (abs is quite frankly the bees knees) a /var/...however, the more observant of you will notice that that is four partitions. Woops. roll

Is there any way to move /var/ somewhere else, and change the partition table or whatever accordingly? I have everything all setup now and I'd really rather not reinstall. I assume not, but i'll ask anyway!

Cheers,

Josh

Edit: Hmm, found this:

1) Reboot into single user mode
2) Mount the var partition somewhere else and copy the contents to /var
3) Edit fstab, comment out /var
4) Unmount the var partition and reboot

Can anyone explain that a little bit more if thats how you do it? Not sure if this should be in newbie corner, really...

Last edited by Tleilaxu (2010-02-06 23:51:28)

Offline

#2 2010-02-07 00:34:12

Coacher
Guest

Re: Relocating /var/ from a separate partition

Well. All steps are correct. Just a few comments.
1) Booting in single mode should prevent starting of any daemons and let you copy all the files. The most secure way is to boot from, for example, LiveCD and mount your root partition and new var partition from there.
2) Don't forget to use -p parameter of cp. It will save file permissions.
3) Don't do any mistakes in this file:)
4) PROFIT!

#3 2010-02-07 02:51:05

Tleilaxu
Member
From: Plymouth, England
Registered: 2010-02-06
Posts: 9

Re: Relocating /var/ from a separate partition

Hi, thanks for the answer. smile

So,

1) Add 'single' to end of kernel grub line

2) umount sdb2 (the partition with var on)
    mount it in another place (i.e. /media/oldvar), which then leaves an 'empty' /var/ like you do if you have a mount point for another hard drive that isn't mounted (?)
    copy oldvar/* to /var/? (With -p! Cheers! That would of been a headache.)

3) comment out fstab sdb2 line

4) unmount /media/oldvar, reboot?

Last edited by Tleilaxu (2010-02-07 02:52:23)

Offline

#4 2010-02-07 07:14:29

fumbles
Member
Registered: 2006-12-22
Posts: 246

Re: Relocating /var/ from a separate partition

So you problem is that you have four partitions on the one hard drive?
Instead of moving var off it you could decide one of the following solutions:

1. Use extended partitions:
Your HDD: |--root--|--extended--/var/swap/home/anything_else/--|--Uni Stuff--|

2. Use LVM to manage your storage. (recommend)

Your HDD: |--/boot--|--LVM--|--Uni stuff--|

Offline

#5 2010-02-07 14:11:01

Tleilaxu
Member
From: Plymouth, England
Registered: 2010-02-06
Posts: 9

Re: Relocating /var/ from a separate partition

fumbles wrote:

So you problem is that you have four partitions on the one hard drive?
Instead of moving var off it you could decide one of the following solutions:

1. Use extended partitions:
Your HDD: |--root--|--extended--/var/swap/home/anything_else/--|--Uni Stuff--|

2. Use LVM to manage your storage. (recommend)

Your HDD: |--/boot--|--LVM--|--Uni stuff--|

Yeah, but that would mean I'd have to reinstall wouldn't it?

Offline

#6 2010-02-07 14:48:06

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Re: Relocating /var/ from a separate partition

Well, you'd have to reformat the disk, yes.

If you have a spare disk, you could copy the existing installation to the spare (don't do this while booted on the existing installation, use a LiveCD or something), reformat the original, then copy back.

Or you could reformat and then reinstall from scratch. Could be easier.

Offline

#7 2010-02-07 15:27:13

Tleilaxu
Member
From: Plymouth, England
Registered: 2010-02-06
Posts: 9

Re: Relocating /var/ from a separate partition

Tleilaxu wrote:

I have everything all setup now and I'd really rather not reinstall. I assume not, but i'll ask anyway!

The point is doing it in a way in which doesn't require me to reinstall. I'm quite aware of LVM, etc. Indeed, if I were to reinstall I'd just not make a separate /var/.


Tleilaxu wrote:

Hi, thanks for the answer. smile

So,

1) Add 'single' to end of kernel grub line

2) umount sdb2 (the partition with var on)
    mount it in another place (i.e. /media/oldvar), which then leaves an 'empty' /var/ like you do if you have a mount point for another hard drive that isn't mounted (?)
    copy oldvar/* to /var/? (With -p! Cheers! That would of been a headache.)

3) comment out fstab sdb2 line

4) unmount /media/oldvar, reboot?

As Coacher was saying, would this work?

Cheers,

Josh

Offline

#8 2010-02-07 15:34:14

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Re: Relocating /var/ from a separate partition

1) Add 'single' to end of kernel grub line. TO BE CLEAR: THEN REBOOT.

2) umount sdb2 (the partition with var on)
    mount it in another place (i.e. /media/oldvar), which then leaves an 'empty' /var/ like you do if you have a mount point for another hard drive that isn't mounted (?)
    copy oldvar/* to /var/? (With -p! Cheers! That would of been a headache.) YOU'LL ALSO NEED AT LEAST -r. BEST OFF USING -a, WHICH INCLUDES -p -r PLUS MORE

3) comment out fstab sdb2 line

4) unmount /media/oldvar, reboot?


That should work.

Offline

#9 2010-02-07 17:21:27

Tleilaxu
Member
From: Plymouth, England
Registered: 2010-02-06
Posts: 9

Re: Relocating /var/ from a separate partition

Profjim wrote:

1) Add 'single' to end of kernel grub line. TO BE CLEAR: THEN REBOOT.

2) umount sdb2 (the partition with var on)
    mount it in another place (i.e. /media/oldvar), which then leaves an 'empty' /var/ like you do if you have a mount point for another hard drive that isn't mounted (?)
    copy oldvar/* to /var/? (With -p! Cheers! That would of been a headache.) YOU'LL ALSO NEED AT LEAST -r. BEST OFF USING -a, WHICH INCLUDES -p -r PLUS MORE

3) comment out fstab sdb2 line

4) unmount /media/oldvar, reboot?


That should work.

Cool, looked up -a.

Thanks, you've both been very helpful. smile

Last edited by Tleilaxu (2010-02-08 00:58:21)

Offline

#10 2010-02-09 11:09:46

fumbles
Member
Registered: 2006-12-22
Posts: 246

Re: Relocating /var/ from a separate partition

Tleilaxu wrote:
fumbles wrote:

So you problem is that you have four partitions on the one hard drive?
Instead of moving var off it you could decide one of the following solutions:

1. Use extended partitions:
Your HDD: |--root--|--extended--/var/swap/home/anything_else/--|--Uni Stuff--|

2. Use LVM to manage your storage. (recommend)

Your HDD: |--/boot--|--LVM--|--Uni stuff--|

Yeah, but that would mean I'd have to reinstall wouldn't it?

Well apart from a reconfiguring of a kernel, changing some config files, and copying stuff here and there.... not at all! The fun of arch linux! smile

Last edited by fumbles (2010-02-09 11:10:03)

Offline

Board footer

Powered by FluxBB