LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-14-2010, 10:27 AM   #1
ShadowReaper
LQ Newbie
 
Registered: Jan 2009
Posts: 22

Rep: Reputation: 0
Resize partition with parted


Hello,

I have a partition, which is 32GB and is mounted to / of the archlinux distribution.

I want to create another partition, I need about 5GB and I want to take them from this partition.

If I use parted to resize the partition will I lose any files?

Thank you
 
Old 12-14-2010, 10:41 AM   #2
ozanbaba
Member
 
Registered: May 2003
Location: İzmir
Distribution: Slackware64 15.0 Multilib
Posts: 778

Rep: Reputation: 135Reputation: 135
Now resizing the partitions without losing data is possible, But you have to move carefully.

First shrink your filesystem. check man resize2fs for ext2/3/4 and man resize_reiserfs. they are pretty simple to use but live resize may not be supported on your system, though

Code:
fsck -f $PARTITION
resize2fs -p $PARTITION 27G
First run fsck and then resize2fs to 27G

after that use parted to resize partition with size 27G. Thick here is that new partition's starting point must be same as old partition. Take a note if you need to. If in doubt, post your commands before running here first.
 
Old 12-14-2010, 10:48 AM   #3
ShadowReaper
LQ Newbie
 
Registered: Jan 2009
Posts: 22

Original Poster
Rep: Reputation: 0
Are you sure it's fsck -f? I read the man page and I cannot find a -f argument
 
Old 12-14-2010, 10:51 AM   #4
ozanbaba
Member
 
Registered: May 2003
Location: İzmir
Distribution: Slackware64 15.0 Multilib
Posts: 778

Rep: Reputation: 135Reputation: 135
-f forces to check clean file systems and it's actually option of what fsck runs for actual file system checking.
 
Old 12-14-2010, 11:49 AM   #5
ShadowReaper
LQ Newbie
 
Registered: Jan 2009
Posts: 22

Original Poster
Rep: Reputation: 0
Ok, i have done fsck and resize2fs.
Now what should i do with parted?
This is the partition table, number 2 is the partition to be resized:
Code:
Number  Start   End    Size    Type     File system  Flags
 1      32.3kB  273GB  273GB   primary  ntfs
 2      273GB   308GB  35.2GB  primary  ext3         boot
 3      308GB   312GB  3989MB  primary  linux-swap
 4      312GB   320GB  8317MB  primary  ext3
 
Old 12-14-2010, 12:39 PM   #6
ozanbaba
Member
 
Registered: May 2003
Location: İzmir
Distribution: Slackware64 15.0 Multilib
Posts: 778

Rep: Reputation: 135Reputation: 135
Code:
(parted) print
Note the non-human readable start number for Number 2

Code:
(parted) resize 2 $NUM2 $NEWEND
Important point is that start number must be same as before.
Before jumping to running the commnads, read help resize for figuring out right numbers.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
resize ext2 partition using parted problems thatwaschrislee Linux - Software 3 01-13-2009 07:20 AM
Resize fat32 filesystem to fill partition using parted jjhunt Linux - Hardware 4 02-14-2008 08:51 AM
Can't resize ext3 partition (using "parted"). Help or advise another app, plz kornerr Linux - General 2 04-28-2005 10:01 AM
Resize Partition with parted jdmml Linux - Hardware 0 07-08-2004 08:43 PM
Parted; trying to resize partition to actuall size Zero-0-Effect Linux - General 3 04-30-2004 10:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration