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
1,809 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
4 Comments
 
LVL 8

Assisted Solution

by:slow1000
slow1000 earned 60 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 180 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 60 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

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 …
Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
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…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

895 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now