Shrink UFS filesystem

Hi people!
the question is pretty simple, can I safely shrink a UFS2 filesystem under a GPT scheme in FreeBSD 9.x?

Thanks a lot for your time.
Regards, Alex.

P.S → I don't have the requirement, but it would be awesome.
 
Yea, I need to create some swap space on EC2 AWS image that comes with no swap, would be good to know how to make it the righteous way :)
 
create some swap space on EC2 AWS image
If you have physical access to the image file you can 'pad' it with zero's or truncate the file to expand size..
Then open image file as a memory disk and create swap in the padded area.. Exit and upload image to the cloud.
No good way to downsize an existing partition.
 
Lets assume the worse. Your AWS image is the max size Amazon allows.

Again a memory disk can be a savior.
Create memdisk of the AWS Image.
Also create a new empty memory disk of the same size. (truncate a new image file same size.)
Create your new disk structure with partitions and desired swap in the new memdisk.
Use clone to duplicate everything from AWS image's memdisk partitions to your new custom image memdisk's partitions.


I create several /mnt directories for exactly these type jobs.
/mnt1
/mnt2
You will need multiple mountpoints to pull off a clone of a memdisk to memdisk.

For example for the EFI/ESP partition:
mount -t msdosfs /dev/md0s1 /mnt1
Notice md0 is my memdisk.
Make sure you properly shutdown your memdisk or disk corruption of your image file could occur.

 
Thanks Phishfry, the problem is 1GB of RAM that limits compilation.. and the memdisk.. it was impossible to shrink with growfs or gpart.. so I have created a new EC2 instance with smaller disk, started the instance, shut down the inctance, increased disk size by 2GB, then in working instance I have added this additional 2GB as freebsd-swap with gpart, and this is it :)
 
Back
Top