LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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-06-2009, 05:48 PM   #1
linus72
LQ Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: Slack14.2/Many
Posts: 5,573

Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
How to set boot flag on USB through the terminal?


What is the command and options.
Thanks.
 
Old 04-06-2009, 06:02 PM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
I think any partitioning program does this---eg fdisk, cfdisk, parted, etc.
 
Old 04-06-2009, 06:04 PM   #3
linus72
LQ Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: Slack14.2/Many
Posts: 5,573

Original Poster
Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
Yes, thank you I know that, but what is the terminal way?
I tried "man boot", and several others-nothing.
How would I do it if I was stuck on runlevel 2/3??
 
Old 04-06-2009, 06:12 PM   #4
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
Why bother - Linux boot loaders don't use the boot flag.
 
Old 04-06-2009, 06:19 PM   #5
linus72
LQ Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: Slack14.2/Many
Posts: 5,573

Original Poster
Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
I'm talking about setting the boot flag on a USB through the terminal-
How is it done?
 
Old 04-06-2009, 06:24 PM   #6
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
As said above, you need to use fdisk (or a similar program). If my memory serves correctly, you need to open the related device and then use the "a" command.

Code:
fdisk /dev/sdd 
# here you will enter the fdisk command line interface
a
And follow whatever instructions appear in your screen. It will surely ask you a partition number.

Anyway, as said above, this is a complete waste of time in most cases. Why do you think that you need to do this? Linux doesn't care at all about the bootable flag, only Windows and dos do as far as I know.
 
Old 04-06-2009, 06:35 PM   #7
linus72
LQ Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: Slack14.2/Many
Posts: 5,573

Original Poster
Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
fdisk didn't work-I'm trying to set the bootable flag on a FAT16 USB device. Of course I could use Gparted, but what if I were in a non-X or terminal environment-how can I do it?
Will cfdisk do it?
I tried but couldn't.
 
Old 04-06-2009, 06:36 PM   #8
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally Posted by linus72 View Post
I'm talking about setting the boot flag on a USB through the terminal-
How is it done?
man sfdisk



Cheers,
Tink
 
Old 04-06-2009, 06:45 PM   #9
linus72
LQ Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: Slack14.2/Many
Posts: 5,573

Original Poster
Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
Nope on sfdisk, just tried parted-but it said it couldn't set lop-back flags or something.
I guess Gparted is the only option?
 
Old 04-06-2009, 08:09 PM   #10
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Quote:
Originally Posted by linus72 View Post
fdisk didn't work-I'm trying to set the bootable flag on a FAT16 USB device. Of course I could use Gparted, but what if I were in a non-X or terminal environment-how can I do it?
Will cfdisk do it?
I tried but couldn't.
"Didn't work" tell us absolutely nothing about the problem.

I just tried:

Code:
# LC_ALL=C fdisk /dev/kingston

The number of cylinders for this disk is set to 2031.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/kingston: 2063 MB, 2063597568 bytes
32 heads, 62 sectors/track, 2031 cylinders
Units = cylinders of 1984 * 512 = 1015808 bytes
Disk identifier: 0x49e2a461

        Device Boot      Start         End      Blocks   Id  System
/dev/kingston1               1        1012     1003873    e  W95 FAT16 (LBA)

Command (m for help): a
Partition number (1-4): 1

Command (m for help): p

Disk /dev/kingston: 2063 MB, 2063597568 bytes
32 heads, 62 sectors/track, 2031 cylinders
Units = cylinders of 1984 * 512 = 1015808 bytes
Disk identifier: 0x49e2a461

        Device Boot      Start         End      Blocks   Id  System
/dev/kingston1   *           1        1012     1003873    e  W95 FAT16 (LBA)

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

Calling ioctl() to re-read partition table.
Syncing disks.
That little asterisk next to kingston1 means that the bootable flag is on.


Quote:
Originally Posted by linus72 View Post
Nope on sfdisk, just tried parted-but it said it couldn't set lop-back flags or something.
I guess Gparted is the only option?
That's paradoxic, because gparted is nothing else but a frontend to parted. So, if gparted works, then parted works.


Still we don't know what's the problem you are trying to solve by adding that flag. Are you trying to install Windows on your pendrive or something?
 
Old 08-10-2010, 12:18 PM   #11
Akuna
LQ Newbie
 
Registered: Aug 2006
Location: France
Distribution: Salix OS
Posts: 7

Rep: Reputation: 0
From man parted:
Quote:
set partition flag state
Change the state of the flag on partition to state. Supported flags are: "boot", "root", "swap", "hidden", "raid", "lvm", "lba", and "palo". State should be either "on" or "off".
If for example your usb device was /dev/sdb1 then the syntax would be:
Code:
parted /dev/sdb set 1 boot on
 
  


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
I am unable to set immutable flag in SuSE udayakumarsv SUSE / openSUSE 1 03-30-2009 11:34 PM
Can BIOS Limitation Prevent Grub from booting Windows if no boot flag set? CJS Linux - General 4 09-08-2008 08:17 AM
how to set O_NONBLOCK flag retroactivaly jf.argentino Programming 10 04-25-2008 02:11 PM
How to add flag to inode i_flags and how to set it devkpict Linux - Kernel 3 12-06-2007 11:41 PM
I'm Having Trouble Trying to Manually Set Cap_Sys_Nice Flag... paintballer1016 Linux - General 3 07-19-2007 07:53 AM

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

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