0

On my CentOS machine I have to create a new partition/file system, not sure which one I need to be honest I am a little bit confused about it all. If someone could explain it and walk me through it that would be great.

The current size of my Harddisk is 190GB, but I am only using 100GB of that.

When I do df -H I get the following output (these are file systems if my understanding is correct?):

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        94G   65G   25G  73% /
tmpfs           938M  1.1M  937M   1% /tmp
tmpfs           1.0G   18M 1007M   2% /var/log/httpd

When I launch parted and use the print command, I see the following output (these are partitions if I understand this correctly?):

GNU Parted 2.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: ATA QEMU HARDDISK (scsi)
Disk /dev/sda: 193GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End    Size   Type     File system  Flags
 1      65.5kB  193GB  193GB  primary  ext3         boot

How can I create a new file system to fill up the remaining space in the partition? I would like to mount this file system on a directory "/home/admin/admin_backups/", so that I can store all my backups on this new file system.

Alternatively it would also be a solution to resize the current file system, what are the advantages/disadvantages of using one or the other approach?

3
  • There seems to be an inconsistency between the output of df, which reports the partition as 94GB in size, and parted, which says it's 193GB. Did you take this output at the same point in time? Commented Jan 13, 2015 at 15:37
  • Yes, I fired both commands in the same minute. Commented Jan 13, 2015 at 19:29
  • I suggest running lsblk to get a better glimpse of the disk usage. Commented Jan 15, 2015 at 13:28

2 Answers 2

7

Since your partition seems larger than your filesystem, try growing the filesystem:

resize2fs /dev/sda1
4
  • Can I do this on a live server or should I reboot into rescue mode? Commented Jan 13, 2015 at 19:29
  • Linux has supported online resizing for ext3/4 for quite some time. I routinely grow filesystems without rebooting. Commented Jan 13, 2015 at 19:30
  • Thank you, are there any risks? If I understand this correctly this will just resize the filesystem to the maximum allowed size by the partition? Commented Jan 13, 2015 at 19:31
  • By default it maximizes the filesystem. The man-page has more details. Commented Jan 13, 2015 at 19:33
1

What you have:

  • a single disk, 193GB in size, known to the system as /dev/sda
  • inside there is one primary partition, taking up all the disk space, known as /dev/sda1
  • this partition is formatted as ext3, and is mounted as the root of your filesystem: /

I suggest using gparted if you have a graphical environment on that host, it is much more intuitive to figure out what you have and what you can do with it than with the CLI version.

With it you can resize existing partitions and create new ones. I suppose you'll want a new primary partition at the end of the disk, which will end up as /dev/sda2, and can then be mounted to your desired location. Add a line to /etc/fstab to mount it automatically at boot time.

3
  • I do not have a graphical environment. What makes you think that the partition takes up all the space on the drive? When I look at the output of df the partition only uses 94GB Commented Jan 13, 2015 at 19:30
  • see the answer by @ptman above, it seems that the filesystem wasn't created with the full partition size. you can tell this from the parted output, which reports size of 193GB for the partition. Commented Jan 13, 2015 at 19:50
  • Thanks, it would be good to adjust your answer as right now the information is incorrect. Commented Jan 15, 2015 at 11:03

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.