[Nottingham] Mount and Filesystem

Graeme Fowler graeme at graemef.net
Tue Sep 25 18:41:01 BST 2007


On Tue, 2007-09-25 at 18:25 +0100, NLUG wrote:
> I have a couple of questions for you.
> Let's say you have a 30GB partition /var on disk 1 (/dev/sda1).
> We also have a 100GB disk 2 which is one big /dev/sdb1 partition.
> The 30GB /var is nearly full...if i mount /dev/sdb1 to /var, what happens?

/var will appear to be empty, and your machine will die a horrid death.

More accurately, you'll probably get an error stating that the mount
point is in use, but still.

> Do i get a 130GB partition?

No.

> if an application keeps adding stuff to /var, where is the data written 
> to ? does it fill up /dev/sda1 first and then carries on to /dev/sdb1?
> Or more simply, can you not mount a partition onto an already mounted 
> partition ?

You can mount one *over* a partition, providing nothing is holding open
any files on that partition first.

What you need to do to move /var to a bigger disk, probably in
single-user mode, is:

1. mkdir /mnt/newvar
2. mount /dev/sdb1 /mnt/newvar
3. rsync -Pav /var/ /mnt/newvar/

[ that bit might take some fiddling to get the new path right, otherwise
you'll end up with /mnt/newvar/var - which is *not* what you want ]

4. umount /mnt/newvar
5. umount /var
6. mount /dev/sdb1 /var

And then edit /etc/fstab to ensure that /var is mounted from /dev/sdb1
rather than /dev/sda1

7. to ensure all is well, reboot.

You'll then have a 30GB disk to with as you want.

If you want to get clever, you need to start using Logical Volumes. This
is a not inconsiderable departure from "normal" partition and disk
management, in that you can span volumes across disks...

Graeme




More information about the Nottingham mailing list