Linux FDISK -L oupu...
 
Notifications
Clear all

Linux FDISK -L ouput ?

4 Posts
4 Users
0 Reactions
439 Views
(@mwade)
Trusted Member
Joined: 18 years ago
Posts: 77
Topic starter  

Hello,

I have a quick question. I was reading that when you run the fdisk command and get the results below that if you are going to carve out a partition you only need to be carve out /sda1 and /sda6 b/c the extended partition is basically /sda5 and /sda6. Is that correct?

/dev/sda1 boot 83 Linux
/dev/sda2 5 Extended
/dev/sda5 82 Swap
/dev/sda6 83 Linux

Thanks,

Mark


   
Quote
(@kovar)
Prominent Member
Joined: 18 years ago
Posts: 805
 

Not necessarily. Did you do

/sbin/fdisk /dev/sda
> p

?

I'd expect to see output that looked more like this

Disk /dev/sda 36.7 GB, 36703934464 bytes
255 heads, 63 sectors/track, 4462 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 1045 8289540 82 Linux swap / Solaris
/dev/sda3 1046 4462 27447052+ 83 Linux

That tells me what, if anything, overlaps. Your extended partition may or may not include sda5 and sda6.

-David


   
ReplyQuote
(@chris2792)
Eminent Member
Joined: 18 years ago
Posts: 33
 

If you are not interested in the content of the swap partition you are right.


   
ReplyQuote
(@farmerdude)
Estimable Member
Joined: 20 years ago
Posts: 242
 

Mark,

First, for carving, you may find the output of this command easier to work with;

sfdisk -l -uS dd.img

Second, go for the low hanging fruit, but don't ignore the higher fruit. Translation = don't blindly trust the output of fdisk or sfdisk, or any other partition table interpreter.

For example, you could have a partition table that looks like;

root@fbcd # sfdisk -l -uS
Device Boot Start End #sectors Id System
/dev/sda1 182980350 187173314 4192965 c W95 FAT32 (LBA)
/dev/sda2 * 96390 75505499 75409110 7 HPFS/NTFS
/dev/sda3 75923190 144649259 68726070 83 Linux
/dev/sda4 147573090 182980349 35407260 5 Extended
/dev/sda5 161517573 169710659 8193087 db CP/M / CTOS / …
/dev/sda6 169710723 173903624 4192902 dd Unknown
/dev/sda7 173903688 182980349 9076662 c W95 FAT32 (LBA)
/dev/sda8 147573153 161517509 13944357 83 Linux

And you could write your data.

Then, you go and change the partition table to be different, perhaps;

Device Boot Start End #sectors Id System
/dev/sda1 182980350 187173314 4192965 c W95 FAT32 (LBA)
/dev/sda2 * 96390 75505499 75409110 7 HPFS/NTFS
/dev/sda3 75923190 144649259 68726070 83 Linux
/dev/sda4 147573090 182980349 35407260 5 Extended
/dev/sda5 161517573 169710659 8193087 db CP/M / CTOS / …
/dev/sda6 169710723 182980349 9076662 82 Linux Swap

The other partitions are still on the disk, the data still resides within them, but the partition tool doesn't know this, it only interprets the partition records in the partition table.

No, you didn't say you wouldn't examine the physical device, but I just know that some folks don't scan the device to validate the partition records. Blind trust can hurt …

regards,

farmerdude


   
ReplyQuote
Share: