Thursday, November 12, 2015

Freebsd Partition EC2 AWS disk

Untitled Document.md In Amazon web services, we can create an AMI that takes a snapshot of our current instance. However, there are times that we need to create an instance with higher disk space using an AMI having a lower disk space.
Following the instructions from: https://www.freebsd.org/doc/handbook/disks-growing.html
After having creating the instance, and specifying a disk of 30gb, (the AMI was only 10gb) it show’s that the 20GB were free.
# gpart show ada0
=>       0  62914560  ada0  BSD  (30G)
         0        16        - free -  (8.0K)
        16  20971504     1  !0  (10G)
  20971520  41943040        - free -  (20G)
We can expand this root via the following commands:
#sudo gpart resize -i 1 -a 4k -s 29G ada0
ada0a resized
Now we can see that its ready for the partitioned,
# gpart show ada0
=>       0  62914560  ada0  BSD  (30G)
         0        16        - free -  (8.0K)
        16  60817408     1  !0  (29G)
  60817424   2097136        - free -  (1.0G)
Apply the partition using:
# sudo growfs /dev/ada0a
Device is mounted read-write; resizing will result in temporary write suspension for /.
It's strongly recommended to make a backup before growing the file system.
OK to grow filesystem on /dev/ada0a, mounted on /, from 10GB to 29GB? [Yes/No] Yes
super-block backups (for fsck_ffs -b #) at:
 21798272, 23080512, 24362752, 25644992, 26927232, 28209472, 29491712, 30773952, 32056192, 33338432, 34620672, 35902912, 37185152, 38467392, 39749632, 41031872, 42314112, 43596352, 44878592, 46160832, 47443072, 48725312, 50007552, 51289792, 52572032, 53854272, 55136512,
 56418752, 57700992, 58983232, 60265472
Check the partition after
staging% df -h
Filesystem    Size    Used   Avail Capacity  Mounted on
/dev/ada0a     28G    7.0G     19G    27%    /
devfs         1.0K    1.0K      0B   100%    /dev
fdescfs       1.0K    1.0K      0B   100%    /dev/fd

No comments:

Post a Comment