Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a CentOS server with two 1 TB disks. However, it is badly partitioned. Please check below:

[root@p16282558 ~]# fdisk -l

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0xd4f28eb2

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         523     4194304   fd  Linux raid autodetect
Partition 1 does not end on cylinder boundary.
/dev/sdb2             523         784     2097152   82  Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/sdb3             784      121602   970470104   fd  Linux raid autodetect
Partition 3 does not end on cylinder boundary.

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x724abfe3

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1         523     4194304   fd  Linux raid autodetect
Partition 1 does not end on cylinder boundary.
/dev/sda2             523         784     2097152   82  Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/sda3             784      121602   970470104   fd  Linux raid autodetect
Partition 3 does not end on cylinder boundary.

Disk /dev/md3: 993.8 GB, 993761296384 bytes
2 heads, 4 sectors/track, 242617504 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000


Disk /dev/md1: 4294 MB, 4294901760 bytes
2 heads, 4 sectors/track, 1048560 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/vg00-usr: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/vg00-var: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/vg00-home: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

When I ran the DF command:

[root@p16282558 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/md1              4.0G  4.0G     0 100% /
/dev/mapper/vg00-usr  4.0G  1.5G  2.4G  38% /usr
/dev/mapper/vg00-var  4.0G  880M  2.9G  23% /var
/dev/mapper/vg00-home
                      4.0G  136M  3.7G   4% /home
none                  7.9G  556K  7.9G   1% /tmp

/opt is within /, and no space left in /

When i ran, /etc/fstab

/dev/md1        /               ext3    defaults        1 1
/dev/sda2   none            swap    sw
/dev/sdb2   none            swap    sw
/dev/vg00/usr   /usr            ext4    defaults        0 2
/dev/vg00/var   /var            ext4    defaults,usrquota   0 2
/dev/vg00/home  /home           ext4    defaults,usrquota   0 2
devpts          /dev/pts        devpts  gid=5,mode=620  0 0
none            /proc           proc    defaults        0 0
none            /tmp    tmpfs   defaults        0 0

So there is a full md1 disk, and a non-utilised Disk /dev/md3 with 993.8 GB free??

But,

[root@p16282558 ~]# df -h /dev/md3
Filesystem            Size  Used Avail Use% Mounted on
-                     7.9G  204K  7.9G   1% /dev

Results of PVS and LVS.

[root@p16282558 ~]# pvs
  PV         VG   Fmt  Attr PSize   PFree
  /dev/md3   vg00 lvm2 a--  925.51g 913.51g

[root@p16282558 ~]# lvs
  LV   VG   Attr      LSize Pool Origin Data%  Move Log Cpy%Sync Convert
  home vg00 -wi-ao--- 4.00g
  usr  vg00 -wi-ao--- 4.00g
  var  vg00 -wi-ao--- 4.00g

Does this mean /dev is not being mounted at system start (as per fstab) ?

My problem is: /opt and /var should be mounted in a disk/partition with more space. How can i restructure the disk to utilize all disk space in an efficient way?

Please help.

Thanks, Sash

share|improve this question
    
Can you add the outputs of pvs and lvs into your question? –  MadHatter Mar 30 at 6:45
    
@MadHatter I have added the outputs. Thanks. –  david Mar 30 at 6:56

1 Answer 1

up vote 3 down vote accepted

It appears you are using LVM on /dev/md3 and that you have only allocated 12GB out of the 1TB available there.

If /opt is where you are spending most of the capacity, you can create a new logical volume and call it vg00-opt. Once that has been created, you can mount it temporarily on /mnt/whatever and move the files from /opt into the new logical volume. Finally you can mount vg00-opt on /opt.

The df -h /dev/md3 command that you typed only told you how much space is used and available on the filesystem used for /dev. Both /tmp and /dev are using tmpfs which will use RAM and/or swap to store the files. Those directories will be empty at boot, but entries in /dev are automatically generated by a deamon started at boot. By default the capacity of a tmpfs is half the amount of RAM, so those two are 8GB in size because you have 16GB of RAM.

share|improve this answer
    
Hi, i have done the following: # create a new 5gb logical volume lvcreate -n opt -L 5G vg00 # format it as ext4 mkfs.ext4 /dev/vg00/opt # move the old dir out of the way mv /opt /opt.orig # mount the new logical volume echo "/dev/vg00/opt /opt ext4 defaults 0 2" >> /etc/fstab mkdir /opt mount /opt # move all data into the new mount mv /opt.orig/* /opt rmdir /opt.orig –  david Mar 31 at 19:47
    
But after these steps when i ran df -h it doesn't show /dev/mapper/vg00-opt??? –  david Mar 31 at 19:48
    
My best guess is that /etc/mtab is not completely up to date with actual mounts. It is possible that the disk was so full, there wasn't free space enough to update /etc/mtab. If you have freed up some space, you can try to umount /opt and then mount it again. –  kasperd Mar 31 at 22:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.