LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] Partition resize

[ILUG] Partition resize

Niall O Broin niall at linux.ie
Sat Jan 17 15:00:27 GMT 2004


On Saturday 17 January 2004 14:04, matthew lemon wrote:

> No. Type          Start  End    Use    Free
> 1 Linux           1      765    /      1 %
> 2 Linux           766    7522   /home  81 %
> 3 Linux swap      7523   7652   swap
>
> There used to be a 4th partition /dev/sda4 which had 50Gb on it.  That
> partition wasn't being used so I want to add the space from that onto the
> partition /dev/sda2 mounted as /home.
>
> Can anyone explain the best way to accomplish this ?

You can't simply add 4 to 2 because 3 is in the way (unless you're using LVM 
or somesuch, and I guess you would have said if you were). So, you need to 
delete 2,3 and 4, make a new bigger 2, make a 3 for swap, and use resize2fs. 

Steps as follows (comments preced by # as usual - all others command to be 
carried out as root)

# back up the data on /home

# back up the data on /home to a different physical medium

# no command given here, because there are so many different ways of
# doing this.

# put the system in single user mode

init 1

# stop using sda3 for swap

swapoff /dev/sda3

# unmount the filesystem on /dev/sda2

umount /home

# now you must delete partitions 2,3 and 4, make a new bigger 2 (for /home)
# and make a new partition 3 (for swap). The new 2 MUST begin at the same
# sector as the old one, which will be the default if you follow the above
# instructions.

fdisk /dev/sda

# resize the ext2 filesystem on partition 2 to be the size of partition 2
# with progress bars for that warm fuzzy feeling

resize2fs -p /dev/sda2

# create swapspace on partition 3

mkswap /dev/sda3

# mount the new enlarged /home filesystem

mount /dev/sda2 /home

# and check your data integrity in whichever way suits you e.g. by comparison
# of checksums with the backup copy.


If the above results in anything breaking, you get to keep ALL the pieces.
And most important of all - the above assumes that you're using ext2 on /home. 
If you're not, the above won't work so don't do it. I'm sure there are 
resizing programs available for other filesystem types but I haven't used 
them.


-- 
Niall




More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell