[arch-general] Migrating /var to a different partition
Hi, I'm doing a clean install of Arch on a new computer, and during the install I'd already set aside 2GiB for the /var partition. Except I forgot to add it to fstab before I exited chroot, and booted into Arch and installed a DE etc. Now two days later I realize that Arch has already created a /var directory on the / partition. How do I migrate /var into the partition I'd originally created for it? Is it as simple as adding a line to fstab and rebooting? Thanks, Krishna
On Thu, Sep 4, 2014 at 1:13 PM, Sri Krishna <kitchi.srikrishna@gmail.com> wrote:
Hi,
I'm doing a clean install of Arch on a new computer, and during the install I'd already set aside 2GiB for the /var partition.
Except I forgot to add it to fstab before I exited chroot, and booted into Arch and installed a DE etc. Now two days later I realize that Arch has already created a /var directory on the / partition. How do I migrate /var into the partition I'd originally created for it?
Is it as simple as adding a line to fstab and rebooting?
Obviously, no. Check pacman -Ql. You'll probably end up booting from cd, moving all data that now resides in /var to your var partition, change fstab and see if that boots. cheers! mar77i
make a filesystem on the extra partition (mkfs.ext4) enter resuce or emergency mode (systemctl rescue) so that the least services run mount the new partition to /mnt move everything from /var to /mnt unmount /mnt edit the /etc/fstab reboot On 4 September 2014 13:13, Sri Krishna <kitchi.srikrishna@gmail.com> wrote:
Hi,
I'm doing a clean install of Arch on a new computer, and during the install I'd already set aside 2GiB for the /var partition.
Except I forgot to add it to fstab before I exited chroot, and booted into Arch and installed a DE etc. Now two days later I realize that Arch has already created a /var directory on the / partition. How do I migrate /var into the partition I'd originally created for it?
Is it as simple as adding a line to fstab and rebooting?
Thanks, Krishna
-- damjan
I'd say copy everything in /var to /mnt. cp -a /var/* /mnt or cp -dpR /var/* /mnt That way you don't lose anything if there's a power cut at an inconvenient time, and you can change ftstab, reboot, and then check everything's working before you hose your original /var (which if you do it this way you really only need to do if (a) "/" is full and (b) original /var is big enough to be worth the trouble reclaiming the space (but remember to go into rescue mode and unmount your new /var first, if you do this!) Jeff Sent from my iPhone
On 4 Sep 2014, at 12:36, Damjan Georgievski <gdamjan@gmail.com> wrote:
make a filesystem on the extra partition (mkfs.ext4) enter resuce or emergency mode (systemctl rescue) so that the least services run
mount the new partition to /mnt move everything from /var to /mnt unmount /mnt edit the /etc/fstab
reboot
On 4 September 2014 13:13, Sri Krishna <kitchi.srikrishna@gmail.com> wrote: Hi,
I'm doing a clean install of Arch on a new computer, and during the install I'd already set aside 2GiB for the /var partition.
Except I forgot to add it to fstab before I exited chroot, and booted into Arch and installed a DE etc. Now two days later I realize that Arch has already created a /var directory on the / partition. How do I migrate /var into the partition I'd originally created for it?
Is it as simple as adding a line to fstab and rebooting?
Thanks, Krishna
-- damjan
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I followed essentially the same process as suggested by Jeff a while back and it worked for me. On 09/04/2014 07:44 AM, Jeff Daniel Rollin-Jones wrote:
I'd say copy everything in /var to /mnt.
cp -a /var/* /mnt
or
cp -dpR /var/* /mnt
That way you don't lose anything if there's a power cut at an inconvenient time, and you can change ftstab, reboot, and then check everything's working before you hose your original /var (which if you do it this way you really only need to do if (a) "/" is full and (b) original /var is big enough to be worth the trouble reclaiming the space (but remember to go into rescue mode and unmount your new /var first, if you do this!)
Jeff
Sent from my iPhone
On 4 Sep 2014, at 12:36, Damjan Georgievski <gdamjan@gmail.com> wrote:
make a filesystem on the extra partition (mkfs.ext4) enter resuce or emergency mode (systemctl rescue) so that the least services run
mount the new partition to /mnt move everything from /var to /mnt unmount /mnt edit the /etc/fstab
reboot
On 4 September 2014 13:13, Sri Krishna <kitchi.srikrishna@gmail.com> wrote: Hi,
I'm doing a clean install of Arch on a new computer, and during the install I'd already set aside 2GiB for the /var partition.
Except I forgot to add it to fstab before I exited chroot, and booted into Arch and installed a DE etc. Now two days later I realize that Arch has already created a /var directory on the / partition. How do I migrate /var into the partition I'd originally created for it?
Is it as simple as adding a line to fstab and rebooting?
Thanks, Krishna
-- damjan -----BEGIN PGP SIGNATURE----- Version: GnuPG v2
iQIcBAEBAgAGBQJUCJL/AAoJEFpnEACTIXf6eqAP/AxO1tS3hATkY3FUa4BVmjLM CE8uUKq/c9/g2zYCXjVbAMc0zqj44l1qNjJ8i5iyUswh9tKHjz+KSUeW0EqLRgTP PXE7SA0pz8S0u98uzZh7lHSuWbLWQmnYklI7S3wocNbsGq+k8Nfw4i1gv6UbJEwW n20kqabzjUXqibqjHDmddx9W2Bwba1eqVRUescI6BwRnVedd1eUsZLuJR8plRx3o nsIDEdsokGBJbaYkDDrxn6dT74qaCSiVJTd8trGMuyDg+Zomqub4Ttvl9IMl/0Ag xMfFGWEoEEiY5V3B9fJQGCHKjvNFkU/M+PcYwGpquvMQXVXogs9MeXRChvT81Ah1 bYYZ204ELsOdMSq/iP1eghO4bdRNvNcT+j8zyb057ockR+FC1ogsulctJVufgDhc nPEgJPWV8DoCyYECgC5uTXdh0MYaOQ19pKkJ1rc1k5cASsflMFxLNvG1GhOoz4oE dcsFIr5zhgcSjxB0uxwX6IQjWp8k0u5W3Ag9qUkvlnwixgu92O3okGArygOPpxpZ HRzqYV87n3CQzLHg5AqZGlxbFR3yApVeS6ew37iO6NBQb46BKgbLimVlWEhL8rHB tvQe0hYUEA2h+Xf4huNY2rwsDnrFfS5k8gzAKiYyu0aFRHH4365MPcJE0VfxIoHK UU8zr7hUG9YMSqGxcauj =S0H0 -----END PGP SIGNATURE-----
On Thu, Sep 4, 2014 at 1:36 PM, Damjan Georgievski <gdamjan@gmail.com> wrote:
make a filesystem on the extra partition (mkfs.ext4) enter resuce or emergency mode (systemctl rescue) so that the least services run
mount the new partition to /mnt move everything from /var to /mnt unmount /mnt edit the /etc/fstab
reboot
-1. Did you try this yourself? Can you think of any errors that your approach might cause? See, if you have open files in /var, they might get recreated on shutdown. Which leaves the mount point nonempty and probably breaks your boot process. cheers! mar77i
So it seems like the most feasible approach is to boot from CD/USB into rescue mode, mount var into /mnt, copy the contents of the old var folder into the new one, add the new one into fstab and reboot. I guess I should also delete the old var folder. I'll try that in the next few days and report back on how it went! Hopefully it won't cause my system to catch fire and explode. :) Thanks, Krishna On 4 September 2014 17:16, Martti Kühne <mysatyre@gmail.com> wrote:
On Thu, Sep 4, 2014 at 1:36 PM, Damjan Georgievski <gdamjan@gmail.com> wrote:
make a filesystem on the extra partition (mkfs.ext4) enter resuce or emergency mode (systemctl rescue) so that the least services run
mount the new partition to /mnt move everything from /var to /mnt unmount /mnt edit the /etc/fstab
reboot
-1. Did you try this yourself? Can you think of any errors that your approach might cause?
See, if you have open files in /var, they might get recreated on shutdown. Which leaves the mount point nonempty and probably breaks your boot process.
cheers! mar77i
participants (5)
-
Damjan Georgievski
-
Jeff Daniel Rollin-Jones
-
John Shier
-
Martti Kühne
-
Sri Krishna