LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 12-15-2012, 09:45 AM   #1
sewerurchin
LQ Newbie
 
Registered: Apr 2012
Posts: 7

Rep: Reputation: Disabled
Copying partition table to new disk


Hi,

I'm trying to get a disk ready for use in a new RAID 1 array. Here are the steps that I am following:

- Dump partition table from existing disk into file:
sfdisk -d /dev/sdd > sdd.out

- cat sdd.out
# partition table of /dev/sdd
unit: sectors

/dev/sdd1 : start= 63, size= 1959867, Id=fd, bootable
/dev/sdd2 : start= 1959930, size= 7807590, Id=fd
/dev/sdd3 : start= 9767520, size= 59936160, Id=fd
/dev/sdd4 : start= 69703680, size=418691375, Id=fd

- Load partition table def into new disk
sfdisk /dev/sde < sdd.out

That works OK. The thing I don't understand is this:
Why does /dev/sde1 have a filesystem on it? There are no filesystems on sde3 or sde4. Shouldn't running 'sfdisk /dev/sde < sdd.out' wipe out all of the filesystems on /dev/sde? TIA for your help.

Model: ATA ST3250823AS (scsi)
Disk /dev/sdd: 250GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 32.3kB 1003MB 1003MB primary ext2 boot, raid
2 1003MB 5001MB 3997MB primary linux-swap(v1) raid
3 5001MB 35.7GB 30.7GB primary ext4 raid
4 35.7GB 250GB 214GB primary ext4 raid

Model: ATA ST3250823AS (scsi)
Disk /dev/sde: 250GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 32.3kB 1003MB 1003MB primary ext2 boot, raid
2 1003MB 5001MB 3997MB primary linux-swap(v1) raid
3 5001MB 35.7GB 30.7GB primary raid
4 35.7GB 250GB 214GB primary raid
 
Old 12-15-2012, 05:24 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,103

Rep: Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117
Quote:
Originally Posted by sewerurchin View Post
Shouldn't running 'sfdisk /dev/sde < sdd.out' wipe out all of the filesystems on /dev/sde?
Nope, it merely updates the partition table, which contains the start and size of each of 4 primary partitions in your case. Nothing is touched outside of the MBR (again, in your case).
Most first partitions start at the same sector, so if a filesystem existed there previously, and is no larger than the newly defined partition, it will be valid. Then same is also possible for later partition(s), but they must align exactly to the correct sector on the disk. Much less likely.
 
1 members found this post helpful.
Old 12-15-2012, 05:59 PM   #3
sewerurchin
LQ Newbie
 
Registered: Apr 2012
Posts: 7

Original Poster
Rep: Reputation: Disabled
Ok, thanks. So what do I do if I want to remove the filesystem?
 
Old 12-15-2012, 06:03 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,103

Rep: Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117
Code:
dd if=/dev/zero of=/dev/sde1 count=100
Should do it.
Watch for typos (mine as well as your own) ...
 
1 members found this post helpful.
Old 12-15-2012, 06:17 PM   #5
sewerurchin
LQ Newbie
 
Registered: Apr 2012
Posts: 7

Original Poster
Rep: Reputation: Disabled
That's pretty much what I figured, but I was a little afraid of 'experimenting' and messing something up.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Disk doesn't contain a valid partition table? vihag Linux - General 5 01-16-2012 04:46 PM
USB flash disk partition disappeared as well as partition table openmind Linux - Newbie 3 02-17-2011 05:20 PM
mysql optimization -- Copying to tmp table on disk yoachan Linux - Server 4 11-23-2010 08:24 AM
GUID Partition Table / Disk Label Slipstream2006 SUSE / openSUSE 2 07-13-2007 06:53 AM
Extract data from disk, without partition table... mandatory Linux - General 1 10-20-2003 06:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 04:09 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