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

So I probably lack some basic fundamental understanding when it comes to unix drives.

On amazon-ec2, I just created an instance where I specified the root device to be 30 GB. If I goto volumes I see the volume in use. But when I ssh into the system and run :

# df -h 
Filesystem    Size    Used   Avail Capacity  Mounted on
/dev/ad0a     9.9G    1.4G    7.7G    16%    /
devfs         1.0k    1.0k      0B   100%    /dev

I don't get it?!

Also, on volumes in amazon, on the details I see Attachment : /dev/sda1 , what does this really mean?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

For the first question, your partition is 10GB, while the drive is 30. Run gpart show to see the partitions on each "drive", including the freespace. You can then figure out what size you want the partition to be and use gpart resize.

Once the partition is 30GB, or whatever size you want, run growfs to resize the filesystem on the partition. Both of these commands take more arguments than I've listed here, see their man pages for details man gpart and man growfs respectively. If you have any specific problems running the commands ask again, or drop into chat, there are a few FreeBSD experts in there.

FreeBSD is not Linux, though many people confuse the two (as did two Answerers who have subsequently deleted their wrong answers). Unfortunately Amazon is guilty too. Linux uses labeling similar to /dev/sda1 for it's first hard drive. FreeBSD uses /dev/ad0 for it's first (S)ATA hard drive (and /dev/da0 for SCSI/SAS drives, including ATAPI, USB, FireWire). Solaris uses /dev/rdsk/cWtXdYsZ... Also FreeBSD adds letters after the device name for MBR Partitions, so /dev/ad0a is the first partition of the first ATA disk. You'll also see /dev/ad0b/, for historical reasons this is the whole disk just like the device name without a partition letter.

share|improve this answer

Most AMI images will expect an 8gb or 10gb root. Consider using the default 8GB and adding a second 20GB device and mounting that where you need to use the data

If you must resize, you can't do it online so you can:

  • Stop Instance
  • Create Snapshot of Volume A from Instance
  • Create Volume B from Snapshot A
  • Attach Volume B to Instance as xbdf
  • Get the new device name and size in bsd
    gpart show
  • Resize your partition (xbd5 for me)
    gpart resize -i 1 -s 30G xbd5
    The parameter to -s might need to be slightly under 30G if your partitioning uses up some free blocks at the start of the drive.
  • Grow your file system
    growfs xbd5a
  • Stop instance A
  • Detach Volume B from Instance
  • Detach Volume A from Instance
  • Attach Volume B as /dev/sda1

The root partitioning of the AMI's from here looks a little strange, I'm not quite sure that they've done so ymmv.

If you plan on creating lots of these, you might want to setup your own AMI image or snapshot your working resized volume so you can start with the same 30GB filesystem each time.

Amazon use /dev/sda1 to refer to an instances initial boot/root device. In Linux it refers to the first partition of the first device which is equivalent to /dev/ad0a in your FreeBSD.

share|improve this answer

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.