LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 03-06-2015, 09:33 AM   #1
LittleLenni
LQ Newbie
 
Registered: Feb 2015
Posts: 20

Rep: Reputation: Disabled
Problem with creating partitions for bootable SD Card


Hi everybody,

I am trying to set up my sd card with an embedded ubuntu I build lately according to this linkhttps://eewiki.net/display/linuxonar...-Ubuntu14.04.1 (Topic Setup microSD/SD card).
I am doing this on Ubuntu running in VirtualBox. I am quite new to linux and barely understand the command that causes the first warning. Here is what happened:

ubuntu@ubuntu-VirtualBox:~$ sudo sfdisk --in-order --Linux --unit M ${DISK} <<-__EOF__ --force
> 1,12,0xE,*
> ,,,-
> __EOF__
Checking that no-one is using this disk right now ...
BLKRRPART: Invalid argument
OK

Disk /dev/sdc1: 1019 cylinders, 246 heads, 62 sectors/track

sfdisk: ERROR: sector 0 does not have an msdos signature
/dev/sdc1: unrecognized partition table type
Old situation:
No partitions found
New situation:
Units = mebibytes of 1048576 bytes, blocks of 1024 bytes, counting from 0

Device Boot Start End MiB #blocks Id System
/dev/sdc1p1 * 1 12 12 12288 e W95 FAT16 (LBA)
/dev/sdc1p2 13 7591 7579 7760896 83 Linux
/dev/sdc1p3 0 - 0 0 0 Empty
/dev/sdc1p4 0 - 0 0 0 Empty
Successfully wrote the new partition table

Re-reading the partition table ...
BLKRRPART: Invalid argument

If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
to zero the first 512 bytes: dd if=/dev/zero of=/dev/foo7 bs=512 count=1
(See fdisk(8).)
ubuntu@ubuntu-VirtualBox:~$ sudo mkfs.vfat -F 16 ${DISK}p1 -n BOOT
mkfs.fat 3.0.26 (2014-03-07)
/dev/sdc1p1: No such file or directory


So after I entered "sudo sfdisk --in-order --Linux --unit M ${DISK} <<-__EOF__ --force
> 1,12,0xE,*
> ,,,-
> __EOF__ "
everything looked fine since it sad that it created the partition sdc1p1 etc. but as soon as I want to format this partition with "sudo mkfs.vfat -F 16 ${DISK}p1 -n BOOT" it tells me that there is no partition called /dev/sdc1p1

I would be very gratefull if somebody could help me out on this. I thought about trying a different tutorial but they look really really different so I tried to stick to the one that worked well for me so far.

Thank you very much!

Regards,

Lenni
 
Old 03-06-2015, 09:57 AM   #2
153rd
Member
 
Registered: Mar 2015
Location: The Netherlands
Distribution: CentOS 7, Ubuntu 12.04, Linux-Mint 17.3
Posts: 46

Rep: Reputation: Disabled
~Hey,

I think your problem is with this part:
${DISK}p1

In unix, hard drives, SD cards, etc are all listed in the /dev/ folder like this:

/dev/sda1
/dev/sdb1/
/dev/sdb2/ and so on.

By writing ${DISK}p1, you basically say:

/dev/sdXp1, which is simply not existent.

If you type ${DISK} instead of ${DISK}p1, you should be fine.
To be sure you can type lsblk, where you can see your SD card if everything goes well..

Good luck!
 
Old 03-06-2015, 10:16 AM   #3
colorpurple21859
Senior Member
 
Registered: Jan 2008
Location: florida
Distribution: slackware64-current, puppy, ubuntu
Posts: 1,904

Rep: Reputation: 261Reputation: 261Reputation: 261
Quote:
export DISK=/dev/mmcblk0
Was used in the tutoral for the ${DISK} to work. The /dev/mmcblk0 for the sd card maybe something different on your system and would need to be changed accordingly.
Per the tutorial
Quote:
For these instruction, we are assuming: DISK=/dev/mmcblk0, "lsblk" is very useful for determining the device id.
run lsblk to fine the sd card dev name.
 
Old 03-08-2015, 06:43 AM   #4
LittleLenni
LQ Newbie
 
Registered: Feb 2015
Posts: 20

Original Poster
Rep: Reputation: Disabled
Hi,

@colorpurple: I did adjust the mmcblk0 allready as I was shown with lsblk.
Here is my SD-Card shown from lsblk:
sdc 8:32 1 7,4G 0 disk
sdc1 8:33 1 7,4G 0 part
So my command was export DISK=/dev/sdc1.

@153rd: Shouldn't the p1 extension come from creating a bootable partition with the sfdisk command?

Thanks for your help folks! Really appreciate it!
 
Old 03-08-2015, 08:33 AM   #5
colorpurple21859
Senior Member
 
Registered: Jan 2008
Location: florida
Distribution: slackware64-current, puppy, ubuntu
Posts: 1,904

Rep: Reputation: 261Reputation: 261Reputation: 261
I think it should be
export DISK=/dev/sdc
 
Old 03-08-2015, 09:13 AM   #6
LittleLenni
LQ Newbie
 
Registered: Feb 2015
Posts: 20

Original Poster
Rep: Reputation: Disabled
I wasn't sure anymore whether I was typing sdc or sdc1. I tried with sdc now and this time I at least didn't get the message: "BLKRRPART: Invalid argument" but BLKRRPART: success.

But still I can't see the new partition --which according to the command text have been successfully build -- when I use lsblk. Any suggestions what could have gone wrong?

The sd card is mounted to media/ubuntu/12B8-CC7E should that be unmounted?

Last edited by LittleLenni; 03-08-2015 at 09:15 AM.
 
Old 03-08-2015, 09:33 AM   #7
colorpurple21859
Senior Member
 
Registered: Jan 2008
Location: florida
Distribution: slackware64-current, puppy, ubuntu
Posts: 1,904

Rep: Reputation: 261Reputation: 261Reputation: 261
if it was me, I would unmount all sd card partitions and start over again with the tutorial using export DISK=/dev/sdc and the for: DISK=/dev/sdX commands.
 
Old 03-08-2015, 10:59 AM   #8
LittleLenni
LQ Newbie
 
Registered: Feb 2015
Posts: 20

Original Poster
Rep: Reputation: Disabled
This is hillarious. I wrote that post above, turned down the computer and went out. I can't guarantee but I am pretty damn sure that when I entered lsblk, that there was only sdc and sdc1. When I came back I started it back up again entered lsblk and taddaaaa I had my two partitions and could keep going. Is a restard necessary for the two partitions to appear?

Thanks for your suggestions. I hope this will work now
 
Old 03-08-2015, 02:28 PM   #9
fatmac
Senior Member
 
Registered: Sep 2011
Location: Surrey/Hants Border, UK
Distribution: BSD & Linux - As long as they are Lightweight
Posts: 1,500

Rep: Reputation: Disabled
Yes, sometimes the system can't update the filesystem info, & a reboot is necessary to use the new partitioning scheme.

Edit: With external disks, you can remove & re insert them to update the info.

Last edited by fatmac; 03-08-2015 at 02:29 PM.
 
Old 03-08-2015, 03:54 PM   #10
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,604

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
Quote:
Originally Posted by fatmac View Post
Yes, sometimes the system can't update the filesystem info, & a reboot is necessary to use the new partitioning scheme.

Edit: With external disks, you can remove & re insert them to update the info.
What sometimes takes a while is for the kernel to re-read the partition table after the device has been written to. It can take some time (usually less than 10 seconds) because it has to ensure that everything that might have the device open will not have a problem. The only time you have to reboot is if you are partitioning a system disk... you don't want the system buffers (which will hold the active partition table) to get written back to disk.

This is why partitioning a device while something is mounted can cause problems - if the new partition is created using only unused space, it isn't too bad. But it should refuse any other request as the device is busy.

It is always safest to have nothing mounted when manipulating the partition table (doing so can cause crashes).

Partitions always refer to sections of a disk (such as sda1 - the first partition of device sda sdb2 - the second partition of device sdb, sdc2 - the second partition of device sdc). When you specify a parition to create a partition, you are referring to creating a partition of a partition (as when specifying sdb1). Doing this is always an error. You always specify the device when creating partitions (sda, sdb, sdc).

Last edited by jpollard; 03-08-2015 at 03:55 PM.
 
Old 03-10-2015, 06:51 AM   #11
LittleLenni
LQ Newbie
 
Registered: Feb 2015
Posts: 20

Original Poster
Rep: Reputation: Disabled
Huuu, these are some interesting details. Thanks for that! Really helped my understanding
 
Old 03-11-2015, 12:48 AM   #12
gdejonge
Member
 
Registered: Aug 2010
Location: Netherlands
Distribution: Kubuntu, Debian, Suse, Slackware
Posts: 317

Rep: Reputation: 73
Or you could use 'partprobe' to tell the kernel that the partition table of the device has changed.

From 'man partprobe':
Quote:
Name

partprobe - inform the OS of partition table changes

Synopsis

partprobe [-d] [-s] [devices...]
Cheers
 
Old 03-11-2015, 06:43 AM   #13
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,604

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
partprobe only works if the disk is not being used...

All it does is wrap the same function used by the partion creation tools to direct the kernel to reload the table.

This is very useful after using something like dd to restore a disk where the partition tables are also restored.
 
  


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
Clone a bootable CF card with multiple partitions and copy to bigger drive RoyLittle0 Linux - Newbie 12 02-22-2015 08:43 AM
Image a bootable CF card with multiple partitions RoyLittle0 Linux - Newbie 1 02-21-2015 11:03 PM
Problem creating bootable CD uk_dave Linux - General 4 08-31-2004 01:08 PM
Problem creating bootable CF enine Linux - General 3 11-10-2003 03:05 PM


All times are GMT -5. The time now is 12:53 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration