How Much Space Before 1st Partition?

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How Much Space Before 1st Partition?
# 1  
Old 11-24-2014
How Much Space Before 1st Partition?

Hello All,

I'm having trouble finding info on how to convert sector size (*if that's really what i want to do?) to something easier to understand.

I'm trying to copy the MBR from a bootable SD Card to another SD Card or image file, but I'm not sure what I should use in my dd command since I'm not positive about how much space is exactly before the 1st partition...

fdisk Output:
Disk /dev/sdc: 7969 MB, 7969177600 bytes
246 heads, 62 sectors/track, 1020 cylinders, total 15564800 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x5503c906

   Device   Boot    Start        End           Blocks      Id    System
/dev/sdc1   *        2048      516099      257026     83   Linux
/dev/sdc2          518144     5918719    2700288   83   Linux

I read on a site that you can just divide the "Start" number in half to get Kilobytes (*which means there is 1MB before the 1st partition), but I'm not positive if that is accurate or not..?

What should I use as my dd command if I want everything BEFORE the first start'ing sector at 2048 (*i.e. before the 1st partition)?

Something like this?
# dd  if=/dev/sdc  of=MBR.img  bs=512  count=???

If any has any thoughts or suggestions it would be much appreciated.

Thanks in Advance,
# 2  
Old 11-24-2014
Copying the MBR could mess up the partition table anyway. What exactly are you trying to do? Would a complete duplicate of your original be good enough?
# 3  
Old 11-24-2014
Hey Corona, thanks for the reply.

I wish it were that easy... I'm not even sure what I want to do is possible, but here we go...

I have a bunch of CuBox's that boot off SD Cards. The CuBox's use the bootloader called U-Boot. And when I do a straight clone from one card
to another I am unable to boot the cloned SD Card. During the boot process, after the U-Boot screen, I get the error during boot log messages that says;

"Failed to find boot device"

I Believe this is because when I did the first boot of the source sd card (*the one that works), U-Boot writes data specific to that SD Card in
the u-boot.img file and also a compiled file called boot.scr. I also believe it records the Offsets, or has them pre-recorded, of the Kernel image file
that is flashed to the SDCard. The boot.scr file contains the kernel image's addr/offset for where to find it...

Another thing I tried was after I cloned the working SD Card to a new one, I mounted the cloned card to my laptop and ran the command:
mkimage -A arm -O linux -a 0 -e 0 -T script -C none -n 'Boot-Script' -d /media/root/boot/boot.script /media/root/boot/boot.scr

Which I believe recreates the boot.scr and boot.script files (*which contains all the boot env variables and boot cmds, etc...)

Now, after I did that and I try to boot the SD Card again, I get MUCH further along in the boot process, but I then get stopped at an error message
that says this below (*the name there is the by-id name of the ORIGINAL SD Card...):
[ ***]  (2 of 2) A start job is running for dev-disk-by\x2did=mmc\x2did=mmc\x2dSD08G_0xda132af2\x2dpart3.device

So I'm thinking the device name is getting written somewhere else in the boot partition, possibly in the zImage-3.14.14-cubox-i kernel
image file or maybe in u-boot.img file... So I thought I would try to take a fresh sd card that has had the OS image flashed to it, but has never
been booted, and copy the MBR and boot partitions from that FRESH SDCard and overwrite the MBR and boot partitions on the CLONED card
and see what happens...

I'm doing this becuase I need to configure about 15 of these CuBox's and I was hoping I could simply configure one SD Card exactly how I want it
then clone the SD Card for the other CUBox's to save A WHOLE LOT OF TIME...

I know when I change Hard Drives on my OpenSuSE laptop and I clone the HDD to a new Drive, I usually just need to edit the HDD names in GRUB and I'm
good to go, but this seems more complicated...

Any ideas?

Thanks Again,
# 4  
Old 11-24-2014
This depends on the hardware and the OS you use. Above info looks like its an IBM compatible PC with a 512 byte sector disk. On non-UEFI systems/disks the MBR is the first sector = 512 bytes. The gap to sector 2048 is there for historical reasons and is usually filled with zeroes unless some feature reserves it for special use.

BUT - as Corona688 says - messing with MBR and disk internals is dangerous and can leave your disks and data unusable!
This User Gave Thanks to RudiC For This Post:
# 5  
Old 11-24-2014
Hey Rudic, thanks for the reply!

Ok gotcha, I knew the MBR was definitely smaller then that full space prior to the first partition but wanted to make sure I wasn't going to miss something while copying..

As for killing the disk if I try this, that's ok, it's just a clone of the original so I can always just make another copy if it gets hosed...

So given the 512-byte sector size and start being = 2048, is that simply 1MB..?

Thanks again for the reply.


Last edited by mrm5102; 11-24-2014 at 03:34 PM..
# 6  
Old 11-24-2014
I've had to mess with u-boot a little bit, and while it's infuriating, it hasn't appeared "magic" in quite that way. How exactly have you been cloning them? A cloned card should boot.
This User Gave Thanks to Corona688 For This Post:
# 7  
Old 11-24-2014
This should work:
dd  if=/dev/sdc  of=MBR.img  bs=512  count=1

Then use xxd or od to check that the last bytes in MBR.img contain the standard MBR signature of "55 AA".
This User Gave Thanks to fpmurphy For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Allot free space from one partition to other

I have a RHEL 5.3 machine with the following partitions and free space: Free space on the partitions / : 74GB /boot : 81MB /var : 73GB /home : 37GB /icat : 758MB /opt : 1.5GB Now is it possible to allot a free space of some other partitions to /opt? I want around 100 GB more space... (4 Replies)
Discussion started by: omniok
4 Replies

2. Shell Programming and Scripting

How to consume all available space on partition?

Hi I'm doing some resilience testing and need to write a script to consume all of the available disk space on a partition and then to free it up again. This would need to be - Safe Dynamic, in that it calculates the free space prior to consuming it. I might want to go on to consume a... (7 Replies)
Discussion started by: bbq
7 Replies

3. Linux

How to increase root space from another partition?

Hi OS Experts I would like to increase root partition from another partition so that I can save more documents in Home and Desktop. whether it is possible without formating root partition if so please explain here is o/p of df -h Filesystem Size Used Avail Use% Mounted on /dev/sda9... (8 Replies)
Discussion started by: Akshay Hegde
8 Replies

4. Slackware

Ideal partition sizes of 17 gb space.

I am planning to install slack 13.37 on an old stand-alone PIII (512 mb ram) with 17 gb disk space. I need to keep lotsa pdf, chm type e-books for programming with few other misc. documents. I'm going to use this system for my personal use. It has no network but I browse internet with cable... (0 Replies)
Discussion started by: vectrum
0 Replies

5. UNIX for Dummies Questions & Answers

shifting space from one partition to other

hi My System is Sun Microsystems Inc. SunOS 5.10 Solaris Partition Info is /dev/vx/dsk/bootdg/var 27G 25G 1.2G 96% /var /dev/vx/dsk/bootdg/oravol 110G 54G 56G 49% /export/home I want to shift space 20G from /export/home to /var What should be the command ?? (2 Replies)
Discussion started by: kaushik02018
2 Replies

6. Red Hat

RHEL 5 supports only 2 TB space for a partition !

Dear Friends , I am using Redhat Ent Linux 5.0 with a EMC storage which HDD space is 4 TB. After Installing RHEL 5 , I get 4 TB space available but when I am going to create a partition then the OS show 2TB available space . I cannot create a partition above 2TB space . Is there any limitation... (3 Replies)
Discussion started by: shipon_97
3 Replies

7. UNIX for Dummies Questions & Answers

Best ways of increasing space on a partition

Hi, On one of our solaris servers, the root partition has filled up,(it was poorly sized in the first place), Does anyone have any advice about the best way to add space to a partition. I'm sure I've read how to do this somewhere before but just can't remember...:( A colleague has suggested... (1 Reply)
Discussion started by: kenny123m
1 Replies

8. Shell Programming and Scripting

Disk space for root partition

Hello, I am trying to monitor disk space for each node on the machine. I am able to get all individual nodes but for the '/' node. For example: df -k: bash-2.05b# df -k Filesystem 1K-blocks Used Available Use% Mounted on /dev/xxx 4127108 2415340 1502120 62% / /dev/yyy ... (3 Replies)
Discussion started by: chiru_h
3 Replies

9. UNIX for Advanced & Expert Users

moving space from one partition to another

How can I move some space allocated to one partition to another, i.e. from "/var" to "/" . Thanks! (4 Replies)
Discussion started by: jason6792
4 Replies

10. UNIX for Dummies Questions & Answers

Swap Partition Space

first of all, sorry about my english...Im a spanish newbie to this marvelous OS and i have just a couple of doubts...u know? :-) 1) how big should my swap partition be if i installed debian 2.2r3 or FreeBSD 4.x on a AMD k7 1400Mhz with 512Mb of Random Access Memory? i heard that those OS... (1 Reply)
Discussion started by: I[X]ION
1 Replies
Login or Register to Ask a Question

Featured Tech Videos