LinuxQuestions.org
Visit the LQ Articles and Editorials section
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
Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: PocketWriter/MinimalX
Posts: 5,057

Rep: Reputation: 328Reputation: 328Reputation: 328Reputation: 328
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: Arch/XFCE
Posts: 17,802

Rep: Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728
I think any partitioning program does this---eg fdisk, cfdisk, parted, etc.
 
Old 04-06-2009, 06:04 PM   #3
linus72
Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: PocketWriter/MinimalX
Posts: 5,057

Original Poster
Rep: Reputation: 328Reputation: 328Reputation: 328Reputation: 328
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: 12,125

Rep: Reputation: 985Reputation: 985Reputation: 985Reputation: 985Reputation: 985Reputation: 985Reputation: 985Reputation: 985
Why bother - Linux boot loaders don't use the boot flag.
 
Old 04-06-2009, 06:19 PM   #5
linus72
Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: PocketWriter/MinimalX
Posts: 5,057

Original Poster
Rep: Reputation: 328Reputation: 328Reputation: 328Reputation: 328
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,036

Rep: Reputation: 372Reputation: 372Reputation: 372Reputation: 372
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
Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: PocketWriter/MinimalX
Posts: 5,057

Original Poster
Rep: Reputation: 328Reputation: 328Reputation: 328Reputation: 328
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: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,965
Blog Entries: 11

Rep: Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865Reputation: 865
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
Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: PocketWriter/MinimalX
Posts: 5,057

Original Poster
Rep: Reputation: 328Reputation: 328Reputation: 328Reputation: 328
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,036

Rep: Reputation: 372Reputation: 372Reputation: 372Reputation: 372
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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/Novell 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


All times are GMT -5. The time now is 08:04 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration