?
Solved

How to resize a swap partition in suse linux at the beginning of the drive and create new partition?

Posted on 2006-06-27
4
Medium Priority
?
1,827 Views
Last Modified: 2013-12-15
Hi there.

To the point: My suse linux-installed drive has these partitions..

sda1 : 2gb, type 82, linux swap
sda2 : 78gb, type 83, linux native, mounted as /.

I want to resize sda1 to 1gb, ensure it continues to act as a swap drive (does this mean recreating the swap format on that drive?) and then create a new partition sda3 to be the /boot partition.

problems I can see with this:

i) putting a new partition in might label the new partition between the first partition (swap) and third partition (data) will mean the new partition (/boot) will be labelled sda2 and the data partition will be referenced as sda3. this will mean changing the fstab file from the rescue disk?

ii) not too sure how to recreate (if neccessary) the swap partition

Any ideas please, people?

thanks for any and all help.

Daryn
0
Comment
Question by:daryn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 8

Assisted Solution

by:slow1000
slow1000 earned 240 total points
ID: 16997582
I would suggest using sda1 as your /boot partition, it reduces the risk of a boot problem.  Post your /etc/fstab file so we can see how everything is set up (labels or direct references, etc.).
0
 
LVL 43

Accepted Solution

by:
ravenpl earned 720 total points
ID: 16999023
Indeed spliting dsa1 to two partitions means that they would be sda1 sda2 and current sda2 become sda3. The problem is even larger, as You manually have to drop all current partitions and recreate whole partition table from scratch. However it's possible to keep the data on current sda2 untouched.
Eg.
root@kruk rc.d]# fdisk -l /dev/sda
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         974     7823623+  fd  Linux raid autodetect
/dev/sda2             975        9680    69930945   fd  Linux raid autodetect

it's possible to delete both partitions(go with fdisk, where You have control over start/end sector), then create
/dev/sda1   *           1         874     ???+  fd  Linux raid autodetect
/dev/sda2             875        9680    ???   fd  Linux raid autodetect
/dev/sda3             975        9680    69930945   fd  Linux raid autodetect

It's just sda3 have to start and end at same sector as previous sda2.
BUT BACKUP FIRST for any sake.

To format the partition as swap: mkswap /dev/sda1
And Yes, You would have to update Your /etc/fstab, possibly bootloader kernel options (root=/dev/sda3) and reinstall bootloader, as boot files are moved to new partition
0
 

Assisted Solution

by:Artiom_M
Artiom_M earned 240 total points
ID: 17051077
For accomplish your task:

1. swapoff /dev/sda1
2. Delete sda1 (swap) partition with fdisk or cfdisk or other (I prefer cfdisk)
3. Create your /boot partition ( it will be sda1)
4. Create your swap partition ( sda3 !!! )
5. Format your swap with mkswap and swapon /dev/sda3.
6. Format your /boot whith mkfs.(of your chois, for exemple mkfs.ext2)
7. Edit your /etc/fstab with the new devices for swap, add the entry for boot:
/dev/sda1            /boot                ext2

8. mount /dev/sda1 elsewhere (ex. /mnt/boot) and copy all files from /boot to /mnt/boot

9. if your bootmanager is Grub thats all. For LILO you must mount your new /boot and launch lilo.


0
 

Author Comment

by:daryn
ID: 17351582
thanks peeps
0

Featured Post

Python: Series & Data Frames With Pandas

Learn the basics of Python’s pandas library of series & data frames and how we can use these tools for data manipulation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses
Course of the Month8 days, 13 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question