cancel
Showing results for 
Search instead for 
Did you mean: 

adding swap partition

SOLVED
Go to solution
kkdurrani
Advisor

adding swap partition

Hi ,
I want to add a swap partition. I have already one disk which configured for swap is there anyway to create the same parttion table on the newdisk. I can use dd but dd copies all the data and creates the same partion table which I dont want. I just want the same layout..or create new one.

Regards,
Karim
8 REPLIES
Ivan Ferreira
Honored Contributor
Solution

Re: adding swap partition

If the disks are exactly the same, you can use the disklabel command to sabe and restore the partition table:

# disklabel â r dsk8 > /root/dsk8.label

# disklabel â R dsk8 /root/dsk8.label

You can use disklabel -rw to create empty new one.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
kkdurrani
Advisor

Re: adding swap partition

Hi Evan,
the output you sent is gibberish. can resend again
Karim
Venkatesh BL
Honored Contributor

Re: adding swap partition

I think he meant,

# disklabel -Â Â r dsk8 > /root/dsk8.label ; copy the disk label of the disk to an ascii file

# disklabel -Â R dsk9 /root/dsk8.label ; create a new disk layout using the ascii configuration file

where, dsk8 is the current swap disk and dsk9 is the new swap disk.

Read the manpage of disklabel for more info.
Ivan Ferreira
Honored Contributor

Re: adding swap partition

# disklabel -r dsk8 > /root/dsk8.label

# disklabel -R dsk8 /root/dsk8.label
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Michael Schulte zur Sur
Honored Contributor

Re: adding swap partition

Hi Karin,

what os version do you run?
Under 4.X you add swap in /etc/fstab.
Under 5.X you add it to /etc/sysconfigtab.
Otherwise you use disklabel as suggested to copy the partition structure and replace any partition type by unused.

greetings,

Michael

Michael Schulte zur Sur
Honored Contributor

Re: adding swap partition

Sorry,

I meant Karim!

Michael
kkdurrani
Advisor

Re: adding swap partition

I am extremly thankful to all you guys for taking time to reply. I am able to add the swap and it works fine now. I have used the additional lun which was not used and used disklable and diskconfig to create and add the swap partitions. works fine now. Thanks again

Karim
kkdurrani
Advisor

Re: adding swap partition

I have used the diskconfig and disklabel as suggested by ivan and michael.