LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-04-2013, 01:00 PM   #1
frambo
LQ Newbie
 
Registered: Apr 2013
Location: Ha Noi, Viet Nam
Posts: 5

Rep: Reputation: Disabled
Partition out of disk


Hi, i'm having trouble.

I think there's a problem with my partition table, i tried to alter things as i found in various forums but sfdisk/fdisk always exited with an error (error closing file)vand no changes were made:

Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

Device Boot Start End #cyls #blocks Id System
/dev/sda1 0+ 5073- 5074- 40749023+ c W95 FAT32 (LBA)
sfdisk: end: (c,h,s) expected (1023,254,63) found (1023,239,63)

/dev/sda2 5073+ 6900- 1828- 14680865 5 Extended
sfdisk: start: (c,h,s) expected (1023,254,63) found (1023,20,51)

sfdisk: end: (c,h,s) expected (1023,254,63) found (1023,239,63)

/dev/sda3 0 - 0 0 0 Empty
/dev/sda4 0 - 0 0 0 Empty
/dev/sda5 5073+ 6770- 1698- 13634560 83 Linux
/dev/sda6 6770+ 6900- 131- 1045504 82 Linux swap / Solaris
Input in the following format; absent fields get a default value.
<start> <size> <type [E,S,L,X,hex]> <bootable [-,*]> <c,h,s> <c,h,s>
Usually you only need to specify <start> and <size> (and perhaps <type>).

Can anyone help me fix my table? I don't need any of the data on the hard drive and would prefer just to format the thing but don't seem to be able to. Any advice is greatfully received
 
Old 04-04-2013, 01:42 PM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
Welcome to LQ.

If you are trying to do partition maintenance on a mounted filesystem, DON'T! Partition maintenance should be done on unmounted filesystems.

Use a liveCD distro (many distro's installation cd/dvd can also be used as live media). Boot into the OS from the cd/dvd, Use fdisk or gparted to delete unwanted partitions and make new partitions. Save the changes and a new partitions table will be created.
 
Old 04-04-2013, 05:27 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
It's easy enough to scrub the partition table - but before that let's see if the basic geometry is still ok. Run these as root/sudo and post the all output
Code:
fdisk -l
parted -l
BTW, sfdisk is not something you'd generally want to use for mangling partition tables - good for backing it up, and that's about all these days.
 
Old 04-05-2013, 12:48 AM   #4
frambo
LQ Newbie
 
Registered: Apr 2013
Location: Ha Noi, Viet Nam
Posts: 5

Original Poster
Rep: Reputation: Disabled
Hi thanks for the advice.
So yes i am using a Live CD, well USB.
ok so here is the output from fdisk and parted:


localhost ~ # umount /dev/sda
umount: /dev/sda: not mounted ##just to check!

localhost ~ # fdisk -l /dev/sda

Disk /dev/sda: 56.8 GB, 56761182720 bytes
240 heads, 63 sectors/track, 7332 cylinders, total 110861685 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x13fd13fc

Device Boot Start End Blocks Id System
/dev/sda1 63 81498109 40749023+ c W95 FAT32 (LBA)
/dev/sda2 81498110 110859839 14680865 5 Extended
/dev/sda5 81498112 108767231 13634560 83 Linux
/dev/sda6 108769280 110860287 1045504 82 Linux swap / Solaris

localhost ~ # parted -l /dev/sda
Error: Can't have overlapping partitions.
Model: ATA IC25N060ATMR04-0 (scsi)
Disk /dev/sda: 56.8GB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags:

Error: Can't have a partition outside the disk!
## I think this ois to do with the USB i'm using for the Live OS
Model: JetFlash Transcend 4GB (scsi)
Disk /dev/sdb: 4050MB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags:

Model: Linux device-mapper (snapshot) (dm)
Disk /dev/mapper/live-osimg-min: 4089MB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags:

Number Start End Size File system Flags
1 0.00B 4089MB 4089MB ext4


Model: Linux device-mapper (snapshot) (dm)
Disk /dev/mapper/live-rw: 4089MB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags:

Number Start End Size File system Flags
1 0.00B 4089MB 4089MB ext4

So I think the problem is the logical partition /sda6 is falling outside the primary partition sda2. I have tried to use fdisk to fix the problem by deleting the sda6 partition:

localhost ~ # fdisk /dev/sda
Welcome to fdisk (util-linux 2.21.1).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Command (m for help): p
Disk /dev/sda: 56.8 GB, 56761182720 bytes
240 heads, 63 sectors/track, 7332 cylinders, total 110861685 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x13fd13fc

Device Boot Start End Blocks Id System
/dev/sda1 63 81498109 40749023+ c W95 FAT32 (LBA)
/dev/sda2 81498110 110859839 14680865 5 Extended
/dev/sda5 81498112 108767231 13634560 83 Linux
/dev/sda6 108769280 110860287 1045504 82 Linux swap / Solaris

Command (m for help): d
Partition number (1-6): 6
Partition 6 is deleted

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

Error closing file

But i end up with the error at the end and the changes aren't saved, and parted won't let me do anything.

Have you got any advice for the next step.
 
Old 04-05-2013, 01:51 AM   #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
I reckon most of these errors started happening when the tools were re-written to accommodate the new alignment theories. I've found simply using an old version of fdisk usually suffices - I keep a couple of old liveCDs for this very reason.
For some interesting reading, have a look at this - note especially "Fixing the Problem the Hard Way". And yes, I do agree with using sfdisk like that. If you are interested in "playing around" you could use it to delete the swap, and maybe even reduce the size of the extended.

For a "quick and easy" fix, if you are happy to lose all the data on the disk try this as root/sudo(after checking /dev/sda is correct)
Code:
dd if=/dev/zero of=/dev/sda seek=446 bs=1 count=64
You will have no partitions, but the data will actually still be there - create some partitions and immediately do a mkfs to avoid any "surprises"
 
Old 04-05-2013, 04:52 AM   #6
frambo
LQ Newbie
 
Registered: Apr 2013
Location: Ha Noi, Viet Nam
Posts: 5

Original Poster
Rep: Reputation: Disabled
Hi i tried as you said but my partition table still exists after running the dd command:

localhost ~ # dd if=/dev/zero of=/dev/sda seek=446 bs=1 count=64
64+0 records in
64+0 records out
64 bytes (64 B) copied, 1.60576 s, 0.0 kB/s
localhost ~ # fdisk -l /dev/sda

Disk /dev/sda: 56.8 GB, 56761182720 bytes
240 heads, 63 sectors/track, 7332 cylinders, total 110861685 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x13fd13fc

Device Boot Start End Blocks Id System
/dev/sda1 63 81498109 40749023+ c W95 FAT32 (LBA)
/dev/sda2 81498110 110859839 14680865 5 Extended
/dev/sda5 81498112 108767231 13634560 83 Linux
/dev/sda6 108769280 110860287 1045504 82 Linux swap / Solaris

Do i just have to ignore this?
sorry if this sounds stupid but what is the best way to make new partitions?
 
Old 04-05-2013, 07:08 AM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
FYI the partition table is located from 447 - 512 i.e. seek=446 only wipes out the boot loader, seek=512 will wipe out the entire MBR. The last post output of the fdisk command now shows the end of sda6 less then the total disk. Rereading the partition table does not always work and a reboot is necessary in some cases.
 
Old 04-08-2013, 05:26 AM   #8
frambo
LQ Newbie
 
Registered: Apr 2013
Location: Ha Noi, Viet Nam
Posts: 5

Original Poster
Rep: Reputation: Disabled
Hey, thanks for all the advice.

I've tried everything but my partition table doesn't seem to want to go anywhere, so it may be I've got a different problem.
 
Old 04-08-2013, 07:26 AM   #9
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Just for clarification I misread syg00's post and that was the correct command. My apologies.

It is possible that you have a different problem.
 
Old 05-02-2013, 10:40 PM   #10
frambo
LQ Newbie
 
Registered: Apr 2013
Location: Ha Noi, Viet Nam
Posts: 5

Original Poster
Rep: Reputation: Disabled
Angry

Hey thans, for all the advice but it seems like it was a hardware problem rather than the partitions.
Had to buy a new Hard drive
Thanks
 
  


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
USB flash disk partition disappeared as well as partition table openmind Linux - Newbie 3 02-17-2011 05:20 PM
Advice on whether to clone/re-partition/re-install OR wipe disk/re-partition/use VM linus72 Linux - Newbie 6 04-16-2009 02:41 AM
Copy files from partition to partition too slow, SATA hard disk.What should I do£¿ Ryanlee SUSE / openSUSE 20 10-31-2005 07:30 AM
Reclaim disk partition from hard disk installation EStester Linux - Enterprise 2 03-09-2005 11:46 AM
Reclaim disk partition from hard disk installation EStester Linux - General 1 03-09-2005 11:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:05 PM.

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