During my experiments with building a seedbox, I noticed that CentOS created a separate partition for the /home directory. Since I was building a seedbox at a cloud provider, I wanted the entire disk as a single partition for large torrent downloads.
Below is an example layout on a default install of CentOS 6.5:
1 2 3 4 5 6 7 8 |
[root@localhost ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup-lv_root 50G 1.2G 46G 3% / tmpfs 935M 0 935M 0% /dev/shm /dev/xvda1 485M 55M 405M 12% /boot /dev/mapper/VolGroup-lv_home 45G 180M 43G 1% /home |
The following commands will remove the /home partition and resize the root one:
1 2 3 4 |
umount /home lvm lvremove /dev/mapper/VolGroup-lv_home lvm lvresize -l+100%FREE /dev/mapper/VolGroup-lv_root resize2fs /dev/mapper/VolGroup-lv_root |
Running df-h again will show that we have a single partition for /:
1 2 3 4 5 6 |
[root@localhost /]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup-lv_root 95G 1.2G 89G 2% / tmpfs 935M 0 935M 0% /dev/shm /dev/xvda1 485M 55M 405M 12% /boot |
Now we still need to edit /ect/fstab to prevent CentOS from trying to mount a non-existent partition on start up. Delete the line that corresponds to the old /home partition; in my example its line 10:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# # /etc/fstab # Created by anaconda on Thu Jul 3 11:57:44 2014 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # /dev/mapper/VolGroup-lv_root / ext4 defaults 1 1 UUID=bba0a5bb-7a8a-4d63-896f-c38b23422de3 /boot ext4 defaults 1 2 /dev/mapper/VolGroup-lv_home /home ext4 defaults 1 2 /dev/mapper/VolGroup-lv_swap swap swap defaults 0 0 tmpfs /dev/shm tmpfs defaults 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0 sysfs /sys sysfs defaults 0 0 proc /proc proc defaults 0 0 |