Showing posts with label resize the Linux partition. Show all posts
Showing posts with label resize the Linux partition. Show all posts

Sunday, January 19, 2014

How to Resize the Root Partition in Linux on Amazon EC2

Check the Root Partition size before resize:
df -h

1The current root partition size is ~8 GB.

After that, stop your instance:
sudo poweroff

2

Go to Volumes on the left-hand EC2 navigation control panel.Right-click on the volume you want to resize and select Create Snapshot.

3Note: Make sure you also check the availability zone.

Fill out the details of the snapshot you are creating.

4

Go to Snapshots on the left-hand EC2 navigation control panel.Right-click on the snapshot you created and select Create Volume from Snapshot.

5

Enter the new size of the partition that you would like to be, select the same availability zone in which your instance is running and click Yes,Create.

6

Go back to the Volumes in the EC2 control panel. Select the old root volume, right click on it and select Detach Volume.

7

Now right click on the new volume that we have just created and select Attach Volume.

8

Please make sure that the volume should be attached as /dev/sda1:

9

Now turn on your instance. Make a note of your partition name, in my case it is /dev/xvda1. Type the resize2fs /dev/xvda1 command.
sudo resize2fs /dev/xvda1

10

After that view the new root partition size.
df -h

11

Yes, it’s work

Hope this will help you!

Please Remember me in your prayers!

Sunday, August 11, 2013

Increase the root filesystem in Linux inside VMWare Workstation/VSphere without LVM

In this tutorial, I’ll explain the step by step procedure to resize the Linux root partition without losing the date. This will be really handy if you are not using LVM and you came to know that your existing root partition is run out of space.

WARNING: It’s really dangerous, so backup your data before attempting this. Please don’t blame me, if you destroy your system. You are responsible for your own actions!

Prerequisites to Start this Tutorial:

You will need to download the GParted live CD ISO file for the later use in this tutorial, so you can get this here.

Let’s start the tutorial by verifying the current root filesystem size:
df -h

1Create any file, just for verification, that we didn’t lose the data during the root partition increase process.

Turn off the virtual machine:
sudo shutdown -h now

2

Once, it shutdown, Click on the “Edit Machine Settings“, select the Hard Disk from the right side and press “Utilities“. A menu will be displayed, select “Expand” from it:

3

Current size is 4GB (It will be different in your case):

4

Increase it to your desired size(mine is 10 GB):

5

Once it will be expanded, will show you the success message:

6

Select the CD/DVD and press Browse:

7

Locate the GParted ISO that we have download in the prerequisite step:

8

Next, Power on the virtual machine to BIOS:

<9

Select the CDROM as first boot device from Boot Menu:

10

Accept the Default Settings:

11

Select “Don’t touch keymap“:

12

Press Enter to accept the default type of keyboard that have:

13

Press Enter again to start GParted in graphic mode:

14

Select the “linux-swap” from the partition layout and press the “Swapoff” from the Partition menu:

15

Select the “exteneded” from the partition layout and press the “Resize/Move“from the Partition menu:

16

Assign all unallocated space to it:

17

Press the “Resize/Move” Button after assigning all the unallocated space:

18

Next, again select the “linux-swap” from the partition layout and press the ”Resize/Move” Button:

19

Move the swap to the end of the extended partition and press the ”Resize/Move” Button:

20

Click “OK“ to the warning:

21

Once again select the “exteneded“ from the partition layout and press the “Resize/Move” button:

22

Shrink it like this, so that it’s size will only be equal to the size of the swap partition by moving the slider from left to the right side and press the “Resize/Move” button:

23

Next, select the “/dev/sda1“,which is root filesystem, from the partition layout and press the ”Resize/Move” Button:

24

Assign all unallocated space to it:

25

Then press the ”Resize/Move” Button:

26

Once you are done with the changes and sure that they are correct, press the “Apply” Button (Be Careful: changes will be irreversible once applied):

27

If everything go well, GParted will show us the “All operations successfully completed”, just press Close:

28

Reboot the system, login to the machine and verify the increase in the size of the partition of root filesystem:
df -h

29

 

Enjoy :-)

Hope this will help you!