Re: [SLUG] mount LVM from Ubuntu live CD
Martin Visser writes: > I don't get how sync will write anything to a "ro" filesystem. > That seems to be to break a fundamental kernel and filesystem principle. ...ah. Um, it doesn't write anything to the file system, as such. It triggers the dirty pages in the kernel cache to write out to their block devices. The "read only" switch in the file system, and to some degree the file system itself, are at a higher level, so are not involved especially. (...and once the file system is read only it *should* not generate any more dirty blocks, although occasionally bugs could trigger this.) > I would have thought either the "remount" would either force a flush of > dirty blocks before it switches to "ro", or alternatively those blocks still > dirty at the time of the "remount" end up in the bit bucket. Nope. Not least because you *can't* make that assurance: the blocks written may be in flight on the HBA, or even the network, between the file system and the magnetic storage. > Also I have seen this 3 sync incantation before. It dates back a *long* time, well before Linux. These days it is seldom, if ever, necessary, but old habits die hard. > It seems to me that all you are doing playing snap with processes that might > have stuff to write but hasn't been flushed. If there are active processes writing, sure. It used to be, once upon a time, that sync didn't (guarantee) to write every dirty block on the system. (Theoretically, with enough block layers between the magnetic storage and the page cache you could perhaps still race to the same conclusion or so, but probably not.) > After any sync and before the final shutdown I presume any running process > is at liberty to create new dirty blocks that may or may not make it to disk > in time. Correct. If you mount the file system read-only, though, you can be confident that no *new* dirty blocks are being generated by that file system, absent bugs. Daniel -- ✣ Daniel Pittman✉ dan...@rimspace.net☎ +61 401 155 707 ♽ made with 100 percent post-consumer electrons -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] mount LVM from Ubuntu live CD
On Sun, Feb 21, 2010 at 02:03:29PM +1100, Martin Visser wrote: > I don't get how sync will write anything to a "ro" filesystem. That seems to > be to break a fundamental kernel and filesystem principle. It won't change anything on the file system as to how it existed in RAM/DISK at the time of the remount. > I would have thought either the "remount" would either force a flush of > dirty blocks before it switches to "ro", or alternatively those blocks still > dirty at the time of the "remount" end up in the bit bucket. The remount doesn't flush the kernel buffer cache. Neither does unmount at least this is what my past experience and a bit of googling tell me. So the sync is necessary. Doing it 3 times is just paranoia, I don't think the sync returns till the disk itself has indicated the blocks are written. This has happened to me everytime I change a root password in single user mode. My usual process is linux init=/bin/sh mount -o remount,rw / vi /etc/passwd reboot # Bugger linux init=/bin/sh mount -o remount,rw / vi /etc/passwd mount -o remount,ro / reboot # Bugger linux init=/bin/sh mount -o remount,rw / vi /etc/passwd mount -o remount,ro / sync reboot # Hurray Cheers, John > > Also I have seen this 3 sync incantation before. It seems to me that all you > are doing playing snap with processes that might have stuff to write but > hasn't been flushed. After any sync and before the final shutdown I presume > any running process is at liberty to create new dirty blocks that may or may > not make it to disk in time. > > Jeremy Visser writes: > > > On 19/02/10 13:41, Daniel Pittman wrote: > > > > > >> ] mount / -o remount,rw > > >> ] passwd root # ...and give it a good password > > >> ] mount / -o remount,ro > > >> ] sync; sync; sync > > >> # wait thirty seconds, because paranoia never hurts > > >> ] sync; sync; sync; reboot > > > > > >> Just be aware that you don't get a lot of nice things like, oh, some > > >> of the "flush on shutdown" behaviour that you do in a normal boot. > > > > > > Shutting down from the GUI, or typing 'halt' isn't magic. It doesn't > > > magically do anything that sync doesn't. How else do you think that the > > > logic works when you shut down? > > > > ...perhaps my working wasn't clear, as you seem to be restating my point? > > > >Daniel > > > > -- > > ✣ Daniel Pittman✉ dan...@rimspace.net☎ +61 401 155 > > 707 > > ♽ made with 100 percent post-consumer electrons > > -- > > SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ > > Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html > > > -- > SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ > Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html -- John Blog http://www.inodes.org LCA2010 http://www.lca2010.org.nz -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] mount LVM from Ubuntu live CD
I don't get how sync will write anything to a "ro" filesystem. That seems to be to break a fundamental kernel and filesystem principle. I would have thought either the "remount" would either force a flush of dirty blocks before it switches to "ro", or alternatively those blocks still dirty at the time of the "remount" end up in the bit bucket. Also I have seen this 3 sync incantation before. It seems to me that all you are doing playing snap with processes that might have stuff to write but hasn't been flushed. After any sync and before the final shutdown I presume any running process is at liberty to create new dirty blocks that may or may not make it to disk in time. Regards, Martin martinvisse...@gmail.com On Sun, Feb 21, 2010 at 12:37 PM, Daniel Pittman wrote: > Jeremy Visser writes: > > On 19/02/10 13:41, Daniel Pittman wrote: > > > >> ] mount / -o remount,rw > >> ] passwd root # ...and give it a good password > >> ] mount / -o remount,ro > >> ] sync; sync; sync > >> # wait thirty seconds, because paranoia never hurts > >> ] sync; sync; sync; reboot > > > >> Just be aware that you don't get a lot of nice things like, oh, some > >> of the "flush on shutdown" behaviour that you do in a normal boot. > > > > Shutting down from the GUI, or typing 'halt' isn't magic. It doesn't > > magically do anything that sync doesn't. How else do you think that the > > logic works when you shut down? > > ...perhaps my working wasn't clear, as you seem to be restating my point? > >Daniel > > -- > ✣ Daniel Pittman✉ dan...@rimspace.net☎ +61 401 155 > 707 > ♽ made with 100 percent post-consumer electrons > -- > SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ > Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html > -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] mount LVM from Ubuntu live CD
Jeremy Visser writes: > On 19/02/10 13:41, Daniel Pittman wrote: > >> ] mount / -o remount,rw >> ] passwd root # ...and give it a good password >> ] mount / -o remount,ro >> ] sync; sync; sync >> # wait thirty seconds, because paranoia never hurts >> ] sync; sync; sync; reboot > >> Just be aware that you don't get a lot of nice things like, oh, some >> of the "flush on shutdown" behaviour that you do in a normal boot. > > Shutting down from the GUI, or typing 'halt' isn't magic. It doesn't > magically do anything that sync doesn't. How else do you think that the > logic works when you shut down? ...perhaps my working wasn't clear, as you seem to be restating my point? Daniel -- ✣ Daniel Pittman✉ dan...@rimspace.net☎ +61 401 155 707 ♽ made with 100 percent post-consumer electrons -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] mount LVM from Ubuntu live CD
On 19/02/10 13:41, Daniel Pittman wrote: > ] mount / -o remount,rw > ] passwd root # ...and give it a good password > ] mount / -o remount,ro > ] sync; sync; sync > # wait thirty seconds, because paranoia never hurts > ] sync; sync; sync; reboot > Just be aware that you don't get a lot of nice things like, oh, some > of the "flush on shutdown" behaviour that you do in a normal boot. Shutting down from the GUI, or typing 'halt' isn't magic. It doesn't magically do anything that sync doesn't. How else do you think that the logic works when you shut down? `mount / -o remount,ro ; sync ; halt_for_real` is pretty safe. signature.asc Description: OpenPGP digital signature -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] mount LVM from Ubuntu live CD
Michael Chesterton writes: > On 19/02/2010, at 1:41 PM, Daniel Pittman wrote: > >> Try booting the kernel with 'init=/bin/bash' on the command line, and then: >> >> ] mount / -o remount,rw >> ] passwd root # ...and give it a good password >> ] mount / -o remount,or >> ] sync; sync; sync >> # wait thirty seconds, because paranoia never hurts >> ] sync; sync; sync; reboot >> >> That should get you past the problem, at least as far as the next issue. > > i guess that's mount / -o remount,ro Yup. > I'm curious about the order of the read-only command, and the syncs. I did > assume there would be nothing to sync on a read-only file system, but I take > it sync works below the file system level? sync instructs the kernel to flush out dirty blocks now; indeed, a read-only file system generates no dirty blocks, but while you had it mounted read-write you would have generated them. Mounting to read-only doesn't necessarily flush all the dirty data, so you need to manually trigger that. In theory, one sync should do it; in practice, this has varied over the years, so the ultra-paranoid version certainly doesn't hurt. :) Daniel -- ✣ Daniel Pittman✉ dan...@rimspace.net☎ +61 401 155 707 ♽ made with 100 percent post-consumer electrons -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] mount LVM from Ubuntu live CD
On 19/02/2010, at 1:41 PM, Daniel Pittman wrote: > Try booting the kernel with 'init=/bin/bash' on the command line, and then: > > ] mount / -o remount,rw > ] passwd root # ...and give it a good password > ] mount / -o remount,or > ] sync; sync; sync > # wait thirty seconds, because paranoia never hurts > ] sync; sync; sync; reboot > > That should get you past the problem, at least as far as the next issue. i guess that's mount / -o remount,ro I'm curious about the order of the read-only command, and the syncs. I did assume there would be nothing to sync on a read-only file system, but I take it sync works below the file system level? -- http://chesterton.id.au/blog/ http://barrang.com.au/linux/ -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] mount LVM from Ubuntu live CD
I've just installed a persistent 64 bit Ubuntu karmic koala on a USB memory stick using the built in live cd creator. I could then install additional packages like skype and flash player and still have them there after a reboot. (the purpose of all this exercise was to test Linux hardware support at the dell kiosk - worked a treat). Just make sure you have all the packages required to make LVM2 work. Good luck, Amos On 2/19/10, david wrote: > Can it be done? > > All the instructions I've found on the net require installation of lvm2 > - not sure this is practical on Live CD, even if it was connected to the > net, which it isn't. > > The computer belongs to a club (I haven't had direct access to it yet) - > the "administrator" has vanished and taken the password with him and the > drive is now at least partly corrupted and won't boot without a root > password. > > fstab tells me it's LVM. > > OS is Fedora 7.x. Would a Fedora live CD mount it? DSL maybe? I don't > have either but would get one if it worked. > -- > SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ > Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html > -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] mount LVM from Ubuntu live CD
david writes: > Can it be done? Sure. > All the instructions I've found on the net require installation of lvm2 - not > sure this is practical on Live CD, even if it was connected to the net, which > it isn't. ...it is practical, and works, but you do need a net connection. IIRC, the live *DVD* includes a huge pool of standard packages which you can use locally, or you could download the required .deb files to a USB key or something and manually install them. Sorry. > The computer belongs to a club (I haven't had direct access to it yet) - the > "administrator" has vanished and taken the password with him and the drive > is now at least partly corrupted and won't boot without a root password. Wanna know a secret: your Linux box is almost certainly trivial to break. Try booting the kernel with 'init=/bin/bash' on the command line, and then: ] mount / -o remount,rw ] passwd root # ...and give it a good password ] mount / -o remount,or ] sync; sync; sync # wait thirty seconds, because paranoia never hurts ] sync; sync; sync; reboot That should get you past the problem, at least as far as the next issue. You can also run a fsck on the root volume or whatever at that shell. Just be aware that you don't get a lot of nice things like, oh, some of the "flush on shutdown" behaviour that you do in a normal boot. :) Daniel -- ✣ Daniel Pittman✉ dan...@rimspace.net☎ +61 401 155 707 ♽ made with 100 percent post-consumer electrons -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] mount LVM from Ubuntu live CD
I've read in the past that the alternate ubuntu live cd has lvm support built in. Maybe check that out, also maybe something like knoppix could do the trick On 19/02/2010, at 0:00, david wrote: Can it be done? All the instructions I've found on the net require installation of lvm2 - not sure this is practical on Live CD, even if it was connected to the net, which it isn't. The computer belongs to a club (I haven't had direct access to it yet) - the "administrator" has vanished and taken the password with him and the drive is now at least partly corrupted and won't boot without a root password. fstab tells me it's LVM. OS is Fedora 7.x. Would a Fedora live CD mount it? DSL maybe? I don't have either but would get one if it worked. -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html