LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-01-2011, 01:57 PM   #1
john_doe777
LQ Newbie
 
Registered: May 2011
Posts: 2

Rep: Reputation: 0
sfdisk starts partition from sector 1 instead of 63


Hi guys. Slackware 13.1, using "sfdisk". I need to use this one as it can be used in a non-interactive mode, "parted" is not a solution for me. That being said, here is the problem.

Inside my own script I make the partition like this:
Code:
# MAKING PATITION:
set `losetup -f`; dev=$1

`losetup $dev $out`
sfdisk $dev << EOF
,,$fsys
EOF
However after formatting this single partition in FAT16 I can see the drive in my emulated Windows311, but not use it. It says that the drive cannot be accessed.
When I do the same thing interactively with fdisk it all works.

When inspecting the partitions in both cases via "fdisk -ul" I see that whenever sfdisk is used to create the partition it is created starting from the 1 sector. Whenever fdisk is used it is created from 63 sector (which is correct of course).

How can I make my sfdisk start the partition not from the 1st sector, but also from the 63 so that OS wouldn't have problem with that?

I tried like this:
Code:
sfdisk -uS $dev << EOF
63,,$fsys
EOF
But it then just says that the partition does not end on the boundary. Trying to see the content with fdisk -ul says that partition table is incorrect. So doing it this way doesn't work.

Would appreciate any help. Thx!
 
Old 05-01-2011, 03:20 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
Use the "-D" (DOS-compatibility) option. From the sfdisk manpage:
Quote:
-D or --DOS

For DOS-compatibility: waste a little space. (More precisely: if a partition cannot contain sector 0, e.g. because that is the MBR of the device, or contains the partition table of an extended partition, then sfdisk would make it start the next sector. However, when this option is given it skips to the start of the next track, wasting for example 33 sectors (in case of 34 sectors/track), just like certain versions of DOS do.) Certain Disk Managers and boot loaders (such as OSBS, but not LILO or the OS/2 Boot Manager) also live in this empty space, so maybe you want this option if you use one.
 
1 members found this post helpful.
Old 05-02-2011, 11:53 AM   #3
john_doe777
LQ Newbie
 
Registered: May 2011
Posts: 2

Original Poster
Rep: Reputation: 0
Thx friend. That worked for me!
 
  


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
sfdisk for logical partition andy233 Linux - Newbie 1 10-14-2010 02:54 PM
Recovering partition table using TestDisk and sfdisk julkwiec Linux - Hardware 2 07-17-2010 03:58 AM
Messed up partition table and Windows' partition boot sector pyromithrandir Linux - General 32 04-08-2006 12:26 PM
boot sector of extended partition canaan General 6 12-20-2005 12:03 AM
how can i partition around a bad sector ? nephish Linux - Hardware 13 12-02-2005 08:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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