13.07.2015 Views

Linux System Administration Recipes A Problem-Solution Approach

Linux System Administration Recipes A Problem-Solution Approach

Linux System Administration Recipes A Problem-Solution Approach

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 5 ■ WORKING WITH FILESYSTEMSIn this setup, /dev/sda1 is /boot, and /dev/sda2 is /, so it’s /dev/sda2 that you want to resize. There’sa couple of gigabytes available in /dev/sda3, the swap partition.What you do this time is first delete /dev/sda3 (the swap partition) with fdisk:fdisk /dev/sdafdisk> dfdisk> 3fdisk> wThen resize /dev/sda2 to use that new free space that was formerly swap:> parted resize /dev/sda2 101 12103■ Note 101 is the megabyte size obtained from 104,391 blocks (that is, the size of /dev/sda1) using bc, asexplained earlier:> echo "104391 * 1024 / (2^20)" | bc10112103 is the megabyte size obtained from (104,391 + 10,241,427 + 2,048,287) blocks (that is, the size of/dev/sda1 plus /dev/sda2 plus /dev/sda3, as shown in the fdisk output) translated in the same way:> echo "(104391+10241427+2048287) * 1024 / (2^20)" | bc12103Resize /dev/sda4 to free up some space at the end of the disk to put a new swap partition in. The endpoint should be current end – previous size of swap partition, so in this case, 59,287,851 – (10,241,438 –104,391) = 49,150,804 blocks, which is 47,998MB:> parted resize /dev/sda4 12104 47998Re-create the swap partition in this new free space:> fdiskfdisk> nfdisk> [ create partition appropriately and set as swap ]Again, you’ll need to tidy up afterward. As discussed earlier, check fdisk -l for the new partitionlabels, or use tune2fs to add human-readable labels.127Download at WoweBook.Com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!