LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 09-10-2011, 08:37 PM   #1
m4rtin
Member
 
Registered: Sep 2007
Posts: 261

Rep: Reputation: 16
Question Is "swap" partition part of the partition table of the MBR?


I have a Dell PowerEdge 860 server with two 1TB SATA HDD's. First HDD has a Linux installation on it and the second HDD is blank:

Code:
root@PE860:~# fdisk -l

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xc94e81b3

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1      119608   960748544   83  Linux
/dev/sda2          119608      121602    16011265    5  Extended
/dev/sda5          119608      121602    16011264   82  Linux swap / Solaris

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xe2c527ab

Disk /dev/sdb doesn't contain a valid partition table
root@PE860:~#
Now if I copy the MBR of the /dev/sda to the /dev/sdb:

Code:
root@PE860:~# dd if=/dev/sda of=/dev/sdb count=1 bs=512
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.000343479 s, 1.5 MB/s
root@PE860:~#
..the swap partition for some reason is not copied:

Code:
root@PE860:~# fdisk -l

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xc94e81b3

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1      119608   960748544   83  Linux
/dev/sda2          119608      121602    16011265    5  Extended
/dev/sda5          119608      121602    16011264   82  Linux swap / Solaris

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xc94e81b3

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1      119608   960748544   83  Linux
/dev/sdb2          119608      121602    16011265    5  Extended
root@PE860:~#
Isn't the swap actually present in the partition table of the MBR?
 
Old 09-10-2011, 09:10 PM   #2
justboo2u
Member
 
Registered: Feb 2011
Distribution: Ubuntu, Debian(ARM),XP,W7,CP/M
Posts: 126

Rep: Reputation: 20
I cant swear to it, but...
you're working with terabyte drives... I doubt one sector is enough...

Try redoing it with 1024 and see if the remainder shows up.

My 2cts!
 
Old 09-10-2011, 09:45 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Quote:
Originally Posted by m4rtin View Post
Isn't the swap actually present in the partition table of the MBR?
[rant]Unless you *really* know what you are doing, copying MBR(s) is just asking for problems.[/rant]
Rebuild the second drive as you want it. Or use a tool designed to do it, like sfdisk.

Your issue has nothing (directly) to do with it being a swap partition, but the fact that it is a logical partition.
 
Old 09-11-2011, 07:35 AM   #4
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
Originally Posted by syg00 View Post
[rant]Unless you *really* know what you are doing, copying MBR(s) is just asking for problems.[/rant]
Nothing in my further explanation below should distract from syg00's correct answer quoted above.

The portion of the partition table in the same sector as the mbr covers only the four initial positions of the partition table that may be primary or extended. Most Linux partition naming rules reserve numbers 1-4 for those.

The first logical partition is number 5, even though you only used two of the initial four positions of the table.

The rest of the partition table is chained together in space preceding each logical partition (Notice SDA2 is one block larger than SDA5). Since you didn't copy any of that, you didn't get any of the info about your logical partition.

The first sector of your SDA2 contains the description of SDA5 as well as a linkage that would be used to indicate which sector would contain the description of SDA6 if there were one.

So after you copied the MBR, and got Linux to recognize sdb2, you could have copied the first sector of sda2 to sdb2, and similarly gotten Linux to recognize sdb5. But unless you have a really good reason for messing around on that level, you are still just asking for trouble.

Last edited by johnsfine; 09-11-2011 at 07:44 AM.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
hard drives come up "no partition table" and "in use by another program" marti972 Linux - Newbie 3 03-16-2009 11:44 PM
"No partition table or unknown signature on partition table" 10.1 install madcow007 Slackware 4 02-09-2009 11:04 AM
When I choose the "Manual" install option, why no swap partition listed in table? cbarnes Linux - Newbie 2 09-09-2008 12:51 PM
Slack 10: S-ATA = "No partition table or unknown signature on partition table"? dissolved soul Slackware - Installation 11 08-05-2004 02:12 PM
Swap Partition hda3 "No such partition" admanb Linux - General 12 01-26-2004 03:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 02:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration