Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
moving a partion to a new sector [solved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
njcwotx
Guru
Guru


Joined: 25 Feb 2005
Posts: 587
Location: Texas

PostPosted: Tue Oct 18, 2016 11:33 pm    Post subject: moving a partion to a new sector [solved] Reply with quote

I have a bootable flash drive I am using on a raspberry pi, parted says the 2nd partition is not aligned.

I want to 'shift' the partion over some to align it. I know what sector to set for aligning. and have created the partition and parted says its aligned.

I am having trouble restoring the partition. I tried for example:

dd if=/dev/sde2 of=sde2.img

using parted I created a partition of the same size and restored with 'dd of=sde2.img if=/dev/sde2'

I can mount the partition afterwards and the file system appears ok, but when I boot. it complains of corruption. fsck finds all sorts of errors.

I was going to try to rsync the filesystem over directly to a new flash, but not sure if that completely works yet either.

Anyone every 'move' a partition?
_________________
Drinking from the fountain of knowldege.
Sometimes sipping.
Sometimes gulping.
Always thirsting.


Last edited by njcwotx on Wed Oct 19, 2016 4:08 am; edited 1 time in total
Back to top
View user's profile Send private message
njcwotx
Guru
Guru


Joined: 25 Feb 2005
Posts: 587
Location: Texas

PostPosted: Tue Oct 18, 2016 11:36 pm    Post subject: Reply with quote

attempting a move with gparted....

2 tries, first move wasnt aligned using with cylinder, but parted still didnt agree.

Tried again with align by Mib and parted agreed with alignment.

Boot up=corruption.

Will try again tonight, this time ill gpart to Mib and expand slightly to give it a try.
_________________
Drinking from the fountain of knowldege.
Sometimes sipping.
Sometimes gulping.
Always thirsting.
Back to top
View user's profile Send private message
Buffoon
Veteran
Veteran


Joined: 17 Jun 2015
Posts: 1369
Location: EU or US

PostPosted: Wed Oct 19, 2016 12:15 am    Post subject: Reply with quote

Parted is probably lying and there is nothing wrong with your partition.
Back to top
View user's profile Send private message
njcwotx
Guru
Guru


Joined: 25 Feb 2005
Posts: 587
Location: Texas

PostPosted: Wed Oct 19, 2016 1:32 am    Post subject: Reply with quote

Its a flash drive with a small block size. The original image works fine and I can rebuild it over and over. Nevertheless, I am working to see how it could be moved and survive. Its not an exercise to 'fix', but more of one of curiosity at this point.
_________________
Drinking from the fountain of knowldege.
Sometimes sipping.
Sometimes gulping.
Always thirsting.
Back to top
View user's profile Send private message
frostschutz
Advocate
Advocate


Joined: 22 Feb 2005
Posts: 2977
Location: Germany

PostPosted: Wed Oct 19, 2016 1:40 am    Post subject: Re: moving a partion to a new sector Reply with quote

njcwotx wrote:
dd if=/dev/sde2 of=sde2.img

using parted I created a partition of the same size and restored with 'dd of=sde2.img if=/dev/sde2'


8O

Are you sure that's what you did? You were supposed to use if=sde2.img there.

Instead you only switched the order of parameters, which does not matter to dd, so you essentially ran the same command twice.

So that second command would have overwritten your sde2.img, with the data of the (presumably moved) sde2 partition.

You should not have been able to mount this. If you fsck'ed it there is no way to recover. fsck is a file system crunch killer, it writes stuff with no way to undo, if it wrote the wrong stuff, there is considerably more damage than before.
Back to top
View user's profile Send private message
njcwotx
Guru
Guru


Joined: 25 Feb 2005
Posts: 587
Location: Texas

PostPosted: Wed Oct 19, 2016 2:20 am    Post subject: Reply with quote

it was just typo in the post.
_________________
Drinking from the fountain of knowldege.
Sometimes sipping.
Sometimes gulping.
Always thirsting.
Back to top
View user's profile Send private message
njcwotx
Guru
Guru


Joined: 25 Feb 2005
Posts: 587
Location: Texas

PostPosted: Wed Oct 19, 2016 4:06 am    Post subject: Reply with quote

I tried from the beginning. Started with a fresh clean image of the bootable flash. Tested its bootup and it worked.

Then I used gparted to shift it and align on MiB. Even expanded it to use rest of drive. Once complete I expanded the first partition to fill up the gap. Parted liked alignment, and the bootable flash worked!

so, gparted can do it. Came across a post cylinder alignment was old school and MiB Alignment was more modern. So thats why I tried it.


-----

dd if=/dev/sdb2 of=sdb2.img seemed to work, I could reverse with dd if=sdb2.img of=/dev/sdb2 and mount it, but the bootable flash had issues and fsck thought it was weird. maybe dd not work as good on partions vs entire disk?
_________________
Drinking from the fountain of knowldege.
Sometimes sipping.
Sometimes gulping.
Always thirsting.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum