Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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)
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
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.
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.
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.
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)
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.