0

I'm really new to linux. I have a server hosted with a reputable company and I just ran out of space on my /var directory. I knew this when i uploaded files and figured that there was a write error.

I do know that the server I've purchased has two hard drives. I'm confused at several things :

  1. Mounting = Putting your hard drive "into" a local directory so that directory will act as storage now?
  2. How you can add more space(mounting?) to your /var or eg : /home2 directory?[i made this directory myself]

This is my current fdisk -l enter image description here Looking at this, I am again filled with questions:

  1. Does Boot and * means it's booted up on boot/reboot?
  2. It says Disk /dev/sda at the top, does sda1,sda2,sda3 stand for partitions on the sda drive? if so, is this the same for sdb?
  3. Then there's the dev/md1 and /dev/md2, This is where i'm greatly confused about.. when purchasing my server the specs were only 2 SSD drives.. why are there 3 drives at 400GB for /dev/sda, /dev/sdb and /dev/md2?
  4. What is the difference between md1 and sda?

I've also browsed online thoroughly, so here's my mount (probably because you'll need it? i'm not sure..)

enter image description here

My /etc/fstab file

    # <file system> <mount point>   <type>  <options>   <dump>  <pass>
/dev/md1    /   ext4    errors=remount-ro,relatime,discard  0   1
/dev/md2    /home   ext4    defaults,relatime,discard   1   2
/dev/sda3   swap    swap    defaults    0   0
/dev/sdb3   swap    swap    defaults    0   0
proc        /proc   proc    defaults        0   0
sysfs       /sys    sysfs   defaults        0   0
devtmpfs    /dev    devtmpfs    rw  0   0

Thank you a lot for looking through this and assisting me! I greatly thank you for your time!

1
  • Start by asking yourself "Why is /var full?", then go have a look at it. ;)
    – Mio Rin
    Commented Apr 21, 2017 at 15:33

2 Answers 2

1

You have two physical drives (/dev/sda and /dev/sdb) which each are partitioned identically with a smaller partition for the root filesystem, a bigger one, and a swap partition.

Each of the first two partitions of both disks are combined together in a RAID 1 array. RAID 1 is mirroring which means that if one disk failed, it could be replaced with another identical disk without any data loss.

Your two resulting RAID arrays are /dev/md1 and /dev/md2. mount shows you that /dev/md1 is mounted as your root (/) and /dev/md2 is mounted in /home.

You therefore do not have any unallocated or unmounted partitions to use on /var. /var is part of the root (/) filesystem which you already filled with 19GB of stuff.

Since the bigger partition is in /home, you might want to save your files there or rearrange everything. Considering your experience level, it might be a bad idea to try to rearrange your mounting points.

If you want to go ahead and do it, you should do some cleanup to get free space to work with, move files from /var to /home, unmount /home and change the mount point to /var. The tricky part is to unmount /home while you're connected to server and once unmounted, you'd also need to ensure the required folders and permissions are set in /home (without the mount) in order to be able to reconnect to it.

A simpler alternative could be to create /home/var, move everything from /var to it, and then remove /var to replace it with a soft link to /home/var.

0

ran out of space on my /var directory

According to the layout you have shared, /var is part of / and the /dev/md2 volume. This could be bad, because it looks like your entire operating system, except for /home, is on that volume. I would move everything out of /home2 and onto /home somewhere safe while you resolve the situation.

Mounting = Putting your hard drive "into" a local directory so that directory will act as storage now?

Sort of. A mounted block device (non-volatile storage device, hard disk, SDD etc.) means it is available to the system for reading and writing. An unmounted drive is connected to the hardware and may be recognized by the kernel and system, but it has not been enabled or authorized for use by the system.

Does Boot and * mean it's booted up on boot/reboot?

Yes, the STAR * in the Boot column indicates that this partition is marked as bootable and the BIOS should look here when poweriong up.

It says Disk /dev/sda at the top, does sda1,sda2,sda3 stand for partitions on the sda drive? if so, is this the same for sdb?

Yes. Linux is labeling the harddrives as sda and sdb, and the physical partitions as a number on each device.

Then there's the dev/md1 and /dev/md2, This is where i'm greatly confused about.. when purchasing my server the specs were only 2 SSD drives.. why are there 3 drives at 400GB for /dev/sda, /dev/sdb and /dev/md2?

Great question! MD is short for Multiple Device driver. This is commonly called software-raid, where the kernel and code uses multipe storage devices and handles read/write operations between them as a hardware raid controller would, via drivers and code.

So you don't actually have three drives, you have two physical drives acting as part of a software raid, and then you have the logical volume that is written to both physical drives appearing as a third drive.

Your provider has configured your system like this:

Physical drives:
/dev/sda
- /dev/sda1 - software raid array #1
- /dev/sda2 - software raid array #2
- /dev/sda3 - swap partition
/dev/sdb
- /dev/sdb1 - software raid array #1
- /dev/sdb2 - software raid array #1
- /dev/sdb3 - swap partition

Logical drives:
/dev/md1 = /  19.5G (software raid, uses /dev/sda1 and /dev/sdb1)
/dev/md2 = /home   427.1 G (software raid, uses /dev/sda2 and /dev/sdb2)

It looks like all of your disk space has been allocated. When you created /home2 it became part of the / filesystem. If you want to add more space for /home2, you will need to add more disks to the system OR reduce the size of /home (/dev/md2) and create a new partition that can be mounted at /home2.

2
  • Thank you for replying!, In this case, looking at fdisk -l and mount.. why is the /dev/sdb2 & /dev/sda2 not booted up instead? It looks like they have more space and thus may be better?
    – Brian Chew
    Commented Apr 22, 2017 at 4:40
  • Because the raid array made up of /dev/sd[ab]1 contains the /boot partition. Its comom practice to put /boot on a dedicated partition, especially if you intend to use Logical Volume Management on the disk. The kernel can't boot from an LVM volume.
    – 0xSheepdog
    Commented Apr 23, 2017 at 13:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .