LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 03-13-2014, 12:07 PM   #1
cilbuper
Member
 
Registered: Mar 2008
Posts: 141

Rep: Reputation: 0
Creating partition table - do I need to format afterwards?


After creating a prartition (83) in fdisk, is it always necessary to run the mkfs.ext3 command to format the drive (I guess this is formatting). I seem to remember deleting the partition tables and creating new ones and not always having to run the mkfs command. The reason I ask is I'm having 2 issues.

I have a 2TB drive that seemed to work find in ubuntu 12.04 but now I can't mount it as it says the superblock or partition table might be bad, the drive reads to be bigger than it actually is (by a small bit, maybe a couple megs). I NEED to get this data back so I figured I'd DD it to a RAID array before messing with the partition table.

Also, I wanted to see if I could delete the MBR/partition table of a USB drive and then recover it. It was formatted in FAT32 or NTFS, I think FAT32. I did the following:
Backup
# dd if=/dev/sdb of=/home/backup-sdb.mbr bs=512 count=1
Delete
# dd if=/dev/zero of=/dev/sdb bs=512 count=1

Restore
I had these two options:
# dd if=/home/backup-sdb.mbr of=/dev/sdb
# dd if=/home/backup-sdb.mbr of=/dev/sdb bs=1 count=64 skip=446 seek=446

After I deleted the partition tables, I fdisk'd and created a ext3 partition, wrote to disk, mounted the drive and the files were all there that were there prior to deleting the partition table. Is that normal? Would running the mkfs.ext3 command after creating the new partition delete the data? I just can't see how the data is still there after seeing that the partitions were gone and changing to a Linux fs. Any ideas?
 
Old 03-13-2014, 12:22 PM   #2
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
That depends on what tool you use to do the partitioning. If you use parted or gparted to create the ext3 partition, they do the mkfs for you, and that would delete all your previous data. If you create the partition with a lower-level tool like fdisk, then you would have to run the mkfs yourself to reformat the partition, and if you did not do that the old contents would still be there.

Linux doesn't (much) care about the type code in the partition table, so it's perfectly possible to have an NTFS or FAT filesystem in a type 0x83 "Linux" partition.

Last edited by rknichols; 03-13-2014 at 12:25 PM. Reason: add "Linux doesn't much care..."
 
1 members found this post helpful.
Old 03-13-2014, 01:52 PM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Yes, fdisk just created a partition i.e. container with the same start and end point as the old one. The actual filesystem was not affected. In creating the new partition you also created a new partition table. So everything is back as it was.

As stated linux does not care about partition labels.
 
1 members found this post helpful.
Old 03-13-2014, 03:44 PM   #4
cilbuper
Member
 
Registered: Mar 2008
Posts: 141

Original Poster
Rep: Reputation: 0
THanks for the info! I kind of had a feeling it might be something like that.

I'm having a problem with the 2TB drive which was NTFS, then I put it in the linux box, Fdsisk'd it to ext3, then mounted it & filled it. This was on ubuntu 12.04. That Os seems to handle NTFS very well. I moved it to other OS's and it isn't recognizing the FS properly. I think I actually have a NTFS format with a ext3 marker or container - does that seem plausible? Would that make me have the problems that I am having?

So I can read the drive on Ubuntu 12.04 with no additional FS support but Kali & backtrack don't see it.

What would be the best way to get these files safely into working order?
 
Old 03-13-2014, 03:57 PM   #5
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
Odd how backups becomes important only after some event underscores their non-existence.

The issue with reading beyond the physical disk is an artifact of changes in the way the Linux tools now align paritions to account for 4k sector drives. Nothing has changed (in normal running) on your disk, just the reporting of it.
The easiest way to fix this is to use gparted to shrink the offending partition - don't scrimp. If it is a logical partition the extended will likewise need to be shrunk. Note that this use of gparted will not erase your data.
As stated a partition entry merely defines the extent of the area - a filesystem is separate. If you do start playing in fdisk or the like be aware that the partition and filesystem must align correctly or you will face similar issues.

IMO it's much more likely you have a filesystem error that caused the partitions to be re-checked. This may preclude the easy resizing. Make sure you have that backup before you start - it may be easier to loop-mount that to do the recovery of the data.
 
Old 03-13-2014, 04:03 PM   #6
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
Looks like we were typing at the same time. Yes that can cause issues - you can change the partition type in any of the tools. Use fdisk and use the "t" subcommand to change the type to "Linux" - you can get a list from within fdisk.
 
  


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
Creating a condensed table from a pre-existing table in putty Deedee393 Linux - Newbie 3 05-16-2012 11:07 AM
Partition table on Advanced Format drives amroth Linux - Hardware 4 01-02-2012 01:36 PM
doesn't contain a valid partition table after creating raid1 via kickstart ncsuapex Linux - Software 3 01-22-2009 10:26 AM
alternate partition table format for linux trabant Linux - Software 0 09-21-2005 08:27 AM
Slack 10: S-ATA = "No partition table or unknown signature on partition table"? dissolved soul Slackware - Installation 11 08-05-2004 02:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

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