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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
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.

757 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

20 Experts available now in Live!

Get 1:1 Help Now