Gaby Vanhegan wrote:
So, I have this disk setup:
# df -h
Filesystem Size Used Avail Capacity Mounted on
/dev/sd0a 49.2G 1.6G 45.2G 3% /
/dev/sd0g 181G 2.0K 172G 0% /backup
/dev/sd0f 167G 549M 158G 0% /home
/dev/sd0e 9.8G 12.0K 9.3G 0% /tmp
/dev/sd0d 49.2G 5.9G 40.8G 13% /var
# disklabel sd0
...
[slightly edited for readability]
16 partitions:
# size offset fstype [fsize bsize cpg]
a: 104857537 63 4.2BSD 2048 16384 323 # Cyl 0*-
51199 (root)
b: 8388608 104857600 swap # Cyl 51200 -
55295 (swap)
c: 980451328 0 unused 0 0 # Cyl 0 -478735
d: 104857600 113246208 4.2BSD 2048 16384 323 # Cyl 5296 -106495 (var)
e: 20971520 218103808 4.2BSD 2048 16384 323 # Cyl 106496
-116735 (tmp)
f: 356515840 239075328 4.2BSD 2048 16384 323 # Cyl 116736
-290815 (home)
g: 384855782 595591168 4.2BSD 2048 16384 323 # Cyl 290816
-478733* (backup)
So far, I have nothing on /backup, nothing particularly interesting
on /home and /tmp is unused. I want to make /var a bit bigger, but I
don't want to rebuild the entire machine from scratch, so could I:
1. Backup all data in /var, /home and /
good first step, yes. :)
2. Using disklabel, remove /backup, /home, /tmp, expand /var a bit,
recreate /backup, /home and /tmp again
3. Use growfs to push /var up to it's new size
4. Restore the data into /home
Is it really that easy to expand a partition? Have I missed
something here? Is it a safer/simpler bit to wipe the disk and start
again?
no, that's basically it.
Other "easy" alternatives would be to reassign your /home partition to
be your /var partition, and copy on the fly, reset fstab, and reboot.
If you wish to do this by remote, you will pretty much need to use this
option, as when you unmount /var, you will probably piss off ssh and
lose your connection to the box.
If you don't want to use all of home for this, just delete home, make a
new partition for /var, copy the data to it, reassign in fstab, reboot.
Yes, you may end up "losing" your old /var, but its obviously a big
disk, you probably won't miss it. Or you can use it for something else
later. BTW: This is exactly the reason I keep saying, "Don't allocate
all your disk unless you really need it!", being able to copy/grow into
unused space is easier than moving/rebuilding.
Safer/simpler to wipe/reload? Not if you have a good backup. If
something goes wrong, you are prepared to do this anyway, might as well
have some fun learning stuff. :)
Nick.