Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Gentoo: User

fsck separate /usr

 

 

Gentoo user RSS feed   Index | Next | Previous | View Threaded


wonko at wonkology

May 12, 2012, 5:43 PM

Post #1 of 11 (459 views)
Permalink
fsck separate /usr

Hi there!

I'm using the new udev with a separate /usr partition. It was encrypted,
and it seems there is no solution yet for this, so I moved it over to an
unencrypted volume - no problem, /usr is one partition where encryption
does not make that much sense anyway. Works, but after an unclean shutdown
(reading files in /proc/<pid>/ was not a good idea) /usr wants to be
fsck'ed. But it is already mounted at that stage.

The boot process just continues, but I wonder what one should do to make
the fsck run. Except for using a live cd.

Maybe I should just enlarge my root partition and move /usr there, at
least this would avoid all the trouble. But I'm used to many separate
partitions, and like it that way.

Wonko


caneko at gmail

May 12, 2012, 5:54 PM

Post #2 of 11 (453 views)
Permalink
Re: fsck separate /usr [In reply to]

On Sat, May 12, 2012 at 7:43 PM, Alex Schuster <wonko [at] wonkology> wrote:
> Hi there!
>
> I'm using the new udev with a separate /usr partition.

How do you create your initramfs? The new udev (>= 182, I believe)
requires the use of an initramfs if you have a separated /usr.

> It was encrypted,
> and it seems there is no solution yet for this.

dracut has two modules, crypt and crypt-gpg, that maybe do what you are needing.

> so I moved it over to an
> unencrypted volume - no problem, /usr is one partition where encryption
> does not make that much sense anyway. Works, but after an unclean shutdown
> (reading files in /proc/<pid>/ was not a good idea) /usr wants to be
> fsck'ed. But it is already mounted at that stage.

That's the reason you need an initramfs.

> The boot process just continues, but I wonder what one should do to make
> the fsck run. Except for using a live cd.

With an initramfs.

> Maybe I should just enlarge my root partition and move /usr there, at
> least this would avoid all the trouble. But I'm used to many separate
> partitions, and like it that way.

You can have every directory under / on a different partition (even
/etc), if you use an initramfs.

Regards.
--
Canek Peláez Valdés
Posgrado en Ciencia e Ingeniería de la Computación
Universidad Nacional Autónoma de México


kwkhui at hkbn

May 12, 2012, 8:54 PM

Post #3 of 11 (467 views)
Permalink
Re: fsck separate /usr [In reply to]

On Sat, 12 May 2012 19:54:24 -0500
Canek Peláez Valdés <caneko [at] gmail> wrote:

> On Sat, May 12, 2012 at 7:43 PM, Alex Schuster <wonko [at] wonkology>
> wrote:
> > Hi there!
> >
> > I'm using the new udev with a separate /usr partition.
>
> How do you create your initramfs? The new udev (>= 182, I believe)
> requires the use of an initramfs if you have a separated /usr.
>
> > It was encrypted,
> > and it seems there is no solution yet for this.
>
> dracut has two modules, crypt and crypt-gpg, that maybe do what you
> are needing.
>
> > so I moved it over to an
> > unencrypted volume - no problem, /usr is one partition where
> > encryption does not make that much sense anyway. Works, but after
> > an unclean shutdown (reading files in /proc/<pid>/ was not a good
> > idea) /usr wants to be fsck'ed. But it is already mounted at that
> > stage.
>
> That's the reason you need an initramfs.

No, that's the reason you want the filesystem's fsck to be included in
the initramfs.

> > The boot process just continues, but I wonder what one should do to
> > make the fsck run. Except for using a live cd.
>
> With an initramfs.

Using initramfs is necessary but itself not sufficient.

One can create an initramfs (from scratch) that does nothing but
mount /usr (with only busybox and a few /dev nodes, plus whatever other
tools needed to find /usr, viz. lvm, cryptsetup and friends, assuming
the necessary drivers are built in the kernel and not as modules ---
see e.g. the old gentoo wiki at
http://www.gentoo-wiki.info/HOWTO_Custom_Initramfs_From_Scratch ).

The initramfs needs to have the relevant fsck tools (plus dependencies)
if it was to perform fsck.

Kerwin.
Attachments: signature.asc (0.82 KB)


caneko at gmail

May 12, 2012, 9:25 PM

Post #4 of 11 (498 views)
Permalink
Re: fsck separate /usr [In reply to]

On Sat, May 12, 2012 at 10:54 PM, <kwkhui [at] hkbn> wrote:
> On Sat, 12 May 2012 19:54:24 -0500
> Canek Peláez Valdés <caneko [at] gmail> wrote:
>
>> On Sat, May 12, 2012 at 7:43 PM, Alex Schuster <wonko [at] wonkology>
>> wrote:
>> > Hi there!
>> >
>> > I'm using the new udev with a separate /usr partition.
>>
>> How do you create your initramfs? The new udev (>= 182, I believe)
>> requires the use of an initramfs if you have a separated /usr.
>>
>> > It was encrypted,
>> > and it seems there is no solution yet for this.
>>
>> dracut has two modules, crypt and crypt-gpg, that maybe do what you
>> are needing.
>>
>> > so I moved it over to an
>> > unencrypted volume - no problem, /usr is one partition where
>> > encryption does not make that much sense anyway. Works, but after
>> > an unclean shutdown (reading files in /proc/<pid>/ was not a good
>> > idea) /usr wants to be fsck'ed. But it is already mounted at that
>> > stage.
>>
>> That's the reason you need an initramfs.
>
> No, that's the reason you want the filesystem's fsck to be included in
> the initramfs.
>
>> > The boot process just continues, but I wonder what one should do to
>> > make the fsck run. Except for using a live cd.
>>
>> With an initramfs.
>
> Using initramfs is necessary but itself not sufficient.
>
> One can create an initramfs (from scratch) that does nothing but
> mount /usr (with only busybox and a few /dev nodes, plus whatever other
> tools needed to find /usr, viz. lvm, cryptsetup and friends, assuming
> the necessary drivers are built in the kernel and not as modules ---
> see e.g. the old gentoo wiki at
> http://www.gentoo-wiki.info/HOWTO_Custom_Initramfs_From_Scratch ).
>
> The initramfs needs to have the relevant fsck tools (plus dependencies)
> if it was to perform fsck.

Dracut (and I believe genkernel, but I don't use it, so I'm not sure)
does all of that (and more, if so desired) for you.

Regards.
--
Canek Peláez Valdés
Posgrado en Ciencia e Ingeniería de la Computación
Universidad Nacional Autónoma de México


wonko at wonkology

May 13, 2012, 3:46 AM

Post #5 of 11 (455 views)
Permalink
Re: fsck separate /usr [In reply to]

Canek Peláez Valdés writes:

> On Sat, May 12, 2012 at 7:43 PM, Alex Schuster <wonko [at] wonkology>
> wrote:

> > I'm using the new udev with a separate /usr partition.
>
> How do you create your initramfs? The new udev (>= 182, I believe)
> requires the use of an initramfs if you have a separated /usr.

I'm using gekernel.

> > It was encrypted,
> > and it seems there is no solution yet for this.
>
> dracut has two modules, crypt and crypt-gpg, that maybe do what you are
> needing.

Maybe, I did not (yet?) try dracut.

> > so I moved it over to an
> > unencrypted volume - no problem, /usr is one partition where
> > encryption does not make that much sense anyway. Works, but after an
> > unclean shutdown (reading files in /proc/<pid>/ was not a good
> > idea) /usr wants to be fsck'ed. But it is already mounted at that
> > stage.
>
> That's the reason you need an initramfs.
>
> > The boot process just continues, but I wonder what one should do to
> > make the fsck run. Except for using a live cd.
>
> With an initramfs.

Not with mine :) Maybe I'll give dracut a try. It seems to be a nice
utility, and I was about to try it, but then I read about Dale's problems
and decided to stay with genkernel for a while.

> > Maybe I should just enlarge my root partition and move /usr there, at
> > least this would avoid all the trouble. But I'm used to many separate
> > partitions, and like it that way.
>
> You can have every directory under / on a different partition (even
> /etc), if you use an initramfs.

Which I do, every partition (including /) is on LVM, and except
for /usr, /usr/src and portage stuff, all is encrypted. But maybe it's
time to drop some partitions, and maybe include at least /usr and /tmp in
the root partition. /usr would be encrypted again then, but the overhead
seems to be small, so why not.

Wonko


rdalek1967 at gmail

May 13, 2012, 5:27 AM

Post #6 of 11 (451 views)
Permalink
Re: fsck separate /usr [In reply to]

Alex Schuster wrote:

> Not with mine :) Maybe I'll give dracut a try. It seems to be a nice
> utility, and I was about to try it, but then I read about Dale's problems
> and decided to stay with genkernel for a while.

>
> Wonko
>
>


I'm not sure but I think the reason I was having so much trouble was
that I didn't remove the failed try at a init thingy in the kernel
itself. I tried that first but it didn't work. When I started trying to
use dracut, I didn't even think to disable or remove the in kernel one.

I have updated my kernel several times since and I have not had a single
issue. So, if you decide to use dracut, make sure you clean out the old
cruft first.

That said, I didn't know dracut could do the file system checks before
mounting and doing the switch_root thing. I see it include the programs
but never seen it actually do the check. Makes me wonder.

Dale

:-) :-)

--
I am only responsible for what I said ... Not for what you understood or
how you interpreted my words!

Miss the compile output? Hint:
EMERGE_DEFAULT_OPTS="--quiet-build=n"


purslow at ca

May 13, 2012, 7:02 AM

Post #7 of 11 (450 views)
Permalink
Re: fsck separate /usr [In reply to]

120513 Alex Schuster wrote:
> I'm using the new udev with a separate /usr partition ...
> after an unclean shutdown
> -- reading files in /proc/<pid>/ was not a good idea --
> /usr wants to be fsck'ed. But it is already mounted at that stage.
> Maybe I should just enlarge my root partition and move /usr there

Did you see my description of how I did that ? -- see list 120506 .
The actual process took me 2 h 30 m , but preparations spread out longer.
Everything else is working just as before,
but I don't have to bother ever about Initramfs (whatever that is : smile),
& can update Udev without any worries when it becomes stable. HTH

--
========================,,============================================
SUPPORT ___________//___, Philip Webb
ELECTRIC /] [] [] [] [] []| Cities Centre, University of Toronto
TRANSIT `-O----------O---' purslowatchassdotutorontodotca


wonko at wonkology

May 13, 2012, 8:11 AM

Post #8 of 11 (447 views)
Permalink
Re: fsck separate /usr [In reply to]

Philip Webb writes:

> 120513 Alex Schuster wrote:
> > I'm using the new udev with a separate /usr partition ...
> > after an unclean shutdown
> > -- reading files in /proc/<pid>/ was not a good idea --
> > /usr wants to be fsck'ed. But it is already mounted at that stage.
> > Maybe I should just enlarge my root partition and move /usr there
>
> Did you see my description of how I did that ? -- see list 120506 .
> The actual process took me 2 h 30 m , but preparations spread out
> longer. Everything else is working just as before,
> but I don't have to bother ever about Initramfs (whatever that is :
> smile), & can update Udev without any worries when it becomes stable.
> HTH

I saw that, but here it will be much easier. All is on LVM here, so this should do it:

# enlarge root partition
lvresize -L +17G /dev/weird/root
cryptsetup resize root
resize2fs /dev/mapper/root

# make sure /usr is not being written to. For other partitions, I'd
# create an LVM snapshot
mount -o remount,ro /usr

# mount root to another place, without mounts like /usr showing up there
mkdir /tmp/bindroot
mount -o bind / /tmp/bindroot

# copy data over
rsync -ax /usr /tmp/bindroot/

# remove /usr stuff from fstab and dmcrypt
sed "/\/dev\/weird\/usr/ d" /etc/fstab
sed -i "/^target=usr2$/{N;N:N:d}" /etc/conf.d/dmcrypt

# done!
reboot

No need for downtime except for the reboot, I guess I cannot unmount /usr
otherwise.

Wonko


neil at digimed

May 13, 2012, 10:08 AM

Post #9 of 11 (450 views)
Permalink
Re: fsck separate /usr [In reply to]

On Sun, 13 May 2012 17:11:55 +0200, Alex Schuster wrote:

> # copy data over
> rsync -ax /usr /tmp/bindroot/

It would be wise to remount /usr read-only before doing this.

> No need for downtime except for the reboot, I guess I cannot
> unmount /usr otherwise.

You could drop to single user mode to unmount /usr, but as that involves
stopping and restarting just about every service, it is just as
convenient to reboot... unless you are aiming for some sort of uptime
record.


--
Neil Bothwick

In possession of a mind not merely twisted, but actually sprained.
Attachments: signature.asc (0.19 KB)


wonko at wonkology

May 13, 2012, 10:27 AM

Post #10 of 11 (446 views)
Permalink
Re: fsck separate /usr [In reply to]

Neil Bothwick writes:

> On Sun, 13 May 2012 17:11:55 +0200, Alex Schuster wrote:
>
> > # copy data over
> > rsync -ax /usr /tmp/bindroot/
>
> It would be wise to remount /usr read-only before doing this.

Yes, as written a few lines above what you quoted :)

> > No need for downtime except for the reboot, I guess I cannot
> > unmount /usr otherwise.
>
> You could drop to single user mode to unmount /usr, but as that involves
> stopping and restarting just about every service, it is just as
> convenient to reboot...

Probably much much more convenient. I even guess the downtime of any
service would actually be less.

> unless you are aiming for some sort of uptime record.

The record is about 420 days, and it will last for a while. So rebooting
every few weeks is okay :) But it's cool that I _could_ do this without
a reboot.

Wonko


neil at digimed

May 13, 2012, 10:44 AM

Post #11 of 11 (448 views)
Permalink
Re: fsck separate /usr [In reply to]

On Sun, 13 May 2012 19:27:07 +0200, Alex Schuster wrote:

> > It would be wise to remount /usr read-only before doing this.
>
> Yes, as written a few lines above what you quoted :)

:P


--
Neil Bothwick

Do hungry crows have ravenous appetites?
Attachments: signature.asc (0.19 KB)

Gentoo user RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.