You are not logged in.

#1 2009-07-13 20:01:04

chris_debian
Member
From: Wiltshire, UK
Registered: 2009-02-24
Posts: 284

[SOLVED] My swap and /home were on a disk I just replaced.

Hi, all.

I was trying Arch on a spare machine and my partitioning looked like this (I think):

/dev/hda1 /boot
/dev/hda2 /

/dev/hdb1 /home (empty)
/devhdb2 swap

My hdb was very old and had huge read/write errors.  I did some tests on it and decided to bin it.

I have put a spare HDD in its place, but obviously my /home and swap no longer exist.

My /home was empty, apart from a couple of files from when it was created. 

Now that I have my replacement HDD in position, what is the best way to check my /etc/fstab to see how my old disk was partitioned, and then recreate a swap and /home partition that can be mounted at boot time?  I know I should have noted this information before I removed the disk, but that's all part of learning about recovery :-).

Any help appreciated.

Cheers,

Chris.

Last edited by chris_debian (2009-07-15 16:58:56)


Reasons why you may want to try GNU/Linux:

www.whylinuxisbetter.net/

Offline

#2 2009-07-13 20:21:25

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: [SOLVED] My swap and /home were on a disk I just replaced.

Your /etc/fstab is still where it always was, in the root filesystem on /dev/hda2. Just set up the new hdb to match it.

Offline

#3 2009-07-14 09:42:39

chris_debian
Member
From: Wiltshire, UK
Registered: 2009-02-24
Posts: 284

Re: [SOLVED] My swap and /home were on a disk I just replaced.

tomk,

Thanks for that.  My post was poorly worded.  What I need to do is:

0) Find a way or reading my /etc/fstab (from a LiveCD?)

1) Format/ apply filesystems to my new disk (as specified in my /etc/fstab).

Can anyone advise me?

Cheers,

Chris.


Reasons why you may want to try GNU/Linux:

www.whylinuxisbetter.net/

Offline

#4 2009-07-14 09:54:03

toad
Member
From: if only I knew
Registered: 2008-12-22
Posts: 1,775
Website

Re: [SOLVED] My swap and /home were on a disk I just replaced.

0) Simply boot into your system, log in as root and adjust your fstab

1) parted or gparted live CD or partedmagic live CD

Personally I'd go for parted, i.e. you can do steps 0 and 1 and log in aftertwards in one go without rebooting.


never trust a toad...
::Grateful ArchDonor::
::Grateful Wikipedia Donor::

Offline

#5 2009-07-14 10:15:53

chris_debian
Member
From: Wiltshire, UK
Registered: 2009-02-24
Posts: 284

Re: [SOLVED] My swap and /home were on a disk I just replaced.

My boot drops to a shell, probably because my swap has disappeared.  It will have to be a LiveCD.

When I boot from a LiveCD (sysresccd), would I mount my / and then look at the /etc/fstab?

I'm thinking something like:

sysrescue CD boots
mount /dev/hda? /
cat/ more /etc/fstab

Once partitions confirmed, use gparted or something to create the new /home and swap?

umount /


Any advice appreciated.

Cheer,

Chris.

Last edited by chris_debian (2009-07-14 12:47:09)


Reasons why you may want to try GNU/Linux:

www.whylinuxisbetter.net/

Offline

#6 2009-07-14 12:52:38

chris_debian
Member
From: Wiltshire, UK
Registered: 2009-02-24
Posts: 284

Re: [SOLVED] My swap and /home were on a disk I just replaced.

<bump> Just edited my last reply.

Chris.


Reasons why you may want to try GNU/Linux:

www.whylinuxisbetter.net/

Offline

#7 2009-07-14 14:09:27

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: [SOLVED] My swap and /home were on a disk I just replaced.

Yeah, sounds fine.

If you're still interested, you might be able to boot your existing install in single user mode, but if you're happy with the Live CD approach, go ahead with it.

Offline

#8 2009-07-14 15:35:18

chris_debian
Member
From: Wiltshire, UK
Registered: 2009-02-24
Posts: 284

Re: [SOLVED] My swap and /home were on a disk I just replaced.

In the old days I'd type Linux single (I think) at the LILO prompt.  Is something similar available with GRUB?

Chris.


Reasons why you may want to try GNU/Linux:

www.whylinuxisbetter.net/

Offline

#9 2009-07-14 15:43:55

miau
Member
Registered: 2009-05-06
Posts: 202

Re: [SOLVED] My swap and /home were on a disk I just replaced.

Maybe this is what you are looking for...but i'm not sure. Link

Last edited by miau (2009-07-14 15:46:09)

Offline

#10 2009-07-14 16:22:57

chris_debian
Member
From: Wiltshire, UK
Registered: 2009-02-24
Posts: 284

Re: [SOLVED] My swap and /home were on a disk I just replaced.

When I dropped to a shell, I mounted the /.  My /etc/fstab no longer uses /dev/hda etc, it has unique ID's for the disks.  Very helpful......

Downloading the systemrescuecd.

:-(


Reasons why you may want to try GNU/Linux:

www.whylinuxisbetter.net/

Offline

#11 2009-07-14 17:24:02

toad
Member
From: if only I knew
Registered: 2008-12-22
Posts: 1,775
Website

Re: [SOLVED] My swap and /home were on a disk I just replaced.

You _can_ use old style hdx/sdx instead of UUIDs in your fstab. To find out UUIDs you can chroot into / from a live system and use the blkid command.


never trust a toad...
::Grateful ArchDonor::
::Grateful Wikipedia Donor::

Offline

#12 2009-07-14 18:59:36

chris_debian
Member
From: Wiltshire, UK
Registered: 2009-02-24
Posts: 284

Re: [SOLVED] My swap and /home were on a disk I just replaced.

toad,

When it drops to a shell, I can use the command prompt. Could I gain the same information this way.  My Gentoo dealings have taught me that chrooting confuses me.

I'll boot the spare box and see.  Looking at  blkid man page, next.

Chris.

EDIT 8< I can use the blkid, but I don't understand how to manipulate the data.  the UUID's are a huge string of characters, that I can't copy.  Is it possible to | (pipe) them somehow.  Failing this, when my rescuecd has downloaded, I can just guess which partition comes first, and if I'm wrong, do it again. Only two options for the partitioning.

Nice to do this from my Arch install though, and keep it in-house :-)

Last edited by chris_debian (2009-07-14 19:09:47)


Reasons why you may want to try GNU/Linux:

www.whylinuxisbetter.net/

Offline

#13 2009-07-14 19:33:05

toad
Member
From: if only I knew
Registered: 2008-12-22
Posts: 1,775
Website

Re: [SOLVED] My swap and /home were on a disk I just replaced.

Oh, you got proper command line, no need for a live cd then. Use hdx/sdx for now. You could of course pipe with awk but you've got to work it out for yourself smile


never trust a toad...
::Grateful ArchDonor::
::Grateful Wikipedia Donor::

Offline

#14 2009-07-14 19:38:36

chris_debian
Member
From: Wiltshire, UK
Registered: 2009-02-24
Posts: 284

Re: [SOLVED] My swap and /home were on a disk I just replaced.

I dabbled wit Sed a long time ago.

I'll look-up some

Mkdir /home

Mkswap sort of stuff. Not sure about creating ext4 /home. I think mke2fs -j may not be good for ext4.

Cheers,

Chris.


Reasons why you may want to try GNU/Linux:

www.whylinuxisbetter.net/

Offline

#15 2009-07-14 22:20:38

chris_debian
Member
From: Wiltshire, UK
Registered: 2009-02-24
Posts: 284

Re: [SOLVED] My swap and /home were on a disk I just replaced.

The gparted live cd worked like a dream.

I now have:

hdb1 /home
hdb2 swap

Unfortunately Arch doesn't agree. I can only think it's because /etc/fstab has these unique UUID codes, which don't match my new drives.  I'm starting to wonder whether it's worth just starting from scratch?

Positive: I get my system working.

Negative:

0) It takes a while to get to a state I'm happy with.

1) I don't learn about fixing my system.

If anyone can help, I'd really appreciate it.

Cheers,

Chris.

Last edited by chris_debian (2009-07-14 22:20:54)


Reasons why you may want to try GNU/Linux:

www.whylinuxisbetter.net/

Offline

#16 2009-07-15 06:27:54

chris_debian
Member
From: Wiltshire, UK
Registered: 2009-02-24
Posts: 284

Re: [SOLVED] My swap and /home were on a disk I just replaced.

Having slept on this, I think the blkid man page said something about an option that checked for blkid's and flushed invalid ones. 

What I probably need to do then is flush/ replace my /etc/fstab blkid's with whatever the ID's of my new partitions are.  So I need to investigate how I do that.  On a Windoze box right now (work), so can't test until this evening.


Reasons why you may want to try GNU/Linux:

www.whylinuxisbetter.net/

Offline

#17 2009-07-15 15:29:00

yvonney
Member
Registered: 2008-06-11
Posts: 671

Re: [SOLVED] My swap and /home were on a disk I just replaced.

Even though i've been tortured in my experiences with puppy linux and it's various idiosyncrasies etc etc. I currently have it installed on a 128 meg USB stick and because my skills are hit and miss and I'm attempting (successfully) to do all kinds of stuff (repo-add ofline repo installs etc)

Anyways... I hope I understood this thread... I'm saying puppy seems to make a quick and effective live cd/usb entity.

Offline

#18 2009-07-15 16:13:48

chris_debian
Member
From: Wiltshire, UK
Registered: 2009-02-24
Posts: 284

Re: [SOLVED] My swap and /home were on a disk I just replaced.

Many thanks for the recommendation.  I hope to be able to run from the shell that my boot drops into, and then use blkid to sort my problems.  Fingers crossed.

Cheers,

Chris.


Reasons why you may want to try GNU/Linux:

www.whylinuxisbetter.net/

Offline

#19 2009-07-15 16:52:54

chris_debian
Member
From: Wiltshire, UK
Registered: 2009-02-24
Posts: 284

Re: [SOLVED] My swap and /home were on a disk I just replaced.

How pleased am I?

Due to the problems cutting and pasting UUID numbers in a non-X terminal, I did the following:

cp /etc/fstab /etc/fstab.old ### back-up original /etc/fstab

blkid -c /dev/null >> /etc/fstab ### get partition ID's for /etc/fstab, using only real ID's and not old no longer available ones (-c /dev/null).  The >> /etc/fstab puts this information at the end of your /etc/fstab which makes it really easy to edit.

My Arch boots :-). I can't start a graphical session because I don't have a config in my /home, but this should be easy to recreate.  I'll look-up the xfce docs.

Looking good :-)

Cheers,

Chris.


Reasons why you may want to try GNU/Linux:

www.whylinuxisbetter.net/

Offline

#20 2009-07-15 16:57:24

toad
Member
From: if only I knew
Registered: 2008-12-22
Posts: 1,775
Website

Re: [SOLVED] My swap and /home were on a disk I just replaced.

Coolie, forget awk smile Didn't know you could do it like that, am a mere user myself... Perhaps mark the thread as solved?


never trust a toad...
::Grateful ArchDonor::
::Grateful Wikipedia Donor::

Offline

#21 2009-07-15 16:58:33

chris_debian
Member
From: Wiltshire, UK
Registered: 2009-02-24
Posts: 284

Re: [SOLVED] My swap and /home were on a disk I just replaced.

Roger, roger.


Reasons why you may want to try GNU/Linux:

www.whylinuxisbetter.net/

Offline

Board footer

Powered by FluxBB