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,812 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

This is the error message I got (CODE) Error caused by incompatible libmp3lame 3.98-2 with ffmpeg I've googled this error message and found out sometimes it attaches this note "can be treated with downgrade libmp3lame to version 3.97 or 3.98" …
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
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.:
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

831 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