Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
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,831 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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

Network Interface Card (NIC) bonding, also known as link aggregation, NIC teaming and trunking, is an important concept to understand and implement in any environment where high availability is of concern. Using this feature, a server administrator …
If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

610 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