I recently made the mistake of installing Linux on a single disk partition. As a result, my home directory and all of my settings were stored on this partition and I was long past due for an OS upgrade. Luckily, a utility called RESIZE2FS for resizing EXT2/3 filesystems exists. With this tool, I was able to shrink the root filesystem from its original 60GB size down to approximately 20GB:
resize2fs -p /dev/sda1 20G
At this point, I could manipulate the partition table, resizing the first partition to 20GB and creating a new partition which would serve as my /home folder in the unused space. As long as the first partition is large enough to encompass the root filesystem, this should not cause any problems.
Finally, I could create a new filesystem in the new partition and copy my home directory there:
mke2fs -J /dev/sda2
At this point, I can install a fresh OS, formatting the root filesystem and still preserve my user settings :)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment