sirko
Posts: 4
Joined: Wed Oct 19, 2016 1:56 pm

Disabling ext4 journaling remote

Wed Oct 19, 2016 2:05 pm

hi,

i want to execute

tune2fs -O ^has_journal /dev/mmcblk0p2
e4fsck –f /dev/mmcblk0p2

during bootup before sd card is mounted.
pi should continue boot process even if something goes wrong, since i have to pay for remote hands on service.

where would you put these commands in?

User avatar
DougieLawson
Posts: 42635
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK

Re: Disabling ext4 journaling remote

Thu Oct 20, 2016 9:34 am

You should build a new SDCard (as a clone of the original), get a USB SDCard reader and use your secondary system with the primary mounted in the USB reader to set journalling on your primary system. It's less risky, it's less likely to destroy everything.

Also you really DO NOT want journalling on an SDCard. Consider moving your rootfs to a USB device.
Languages using left-hand whitespace for syntax are ridiculous

DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.

The use of crystal balls and mind reading is prohibited.

sirko
Posts: 4
Joined: Wed Oct 19, 2016 1:56 pm

Re: Disabling ext4 journaling remote

Thu Oct 20, 2016 11:20 am

too late.
wrote a systemd unit to do it, forgot to set timeout there.
machine is already down, and now i'm waiting for hands on call...

:cry:

User avatar
DougieLawson
Posts: 42635
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK

Re: Disabling ext4 journaling remote

Thu Oct 20, 2016 12:27 pm

sirko wrote:... now i'm waiting for hands on call...
Eh?

Get a second SDCard and a USB reader. Build a fresh copy of Raspbian on the new card, use that with the USB reader to rescue your original card from the damage you've done to it.
Languages using left-hand whitespace for syntax are ridiculous

DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.

The use of crystal balls and mind reading is prohibited.

sirko
Posts: 4
Joined: Wed Oct 19, 2016 1:56 pm

Re: Disabling ext4 journaling remote

Fri Oct 21, 2016 12:00 pm

pi is located in a foreign data center. no physical access.

User avatar
jojopi
Posts: 3812
Joined: Tue Oct 11, 2011 8:38 pm

Re: Disabling ext4 journaling remote

Fri Oct 21, 2016 12:57 pm

DougieLawson wrote:Also you really DO NOT want journalling on an SDCard.
I know that you probably consider it a virtue, but you have wasted another two posts in this thread. The intent of the commands in the original post was to disable journalling. You are advising the poster to do exactly the thing he wanted to do, but without answering his question of how to achieve it remotely.

Also, if you think that having ext4 journalling on an SD Card is a bad thing, why on earth are you revealing that to a first poster on the forums, and not to ShiftPlusOne or whoever makes the Foundation's images these days?
sirko wrote:during bootup before sd card is mounted.
There is no before card is mounted, really. Pi images generally boot without using an initramfs. There may be a time early in the boot sequence when the filesystem is still read-only, but messing with the boot scripts strikes me as far more dangerous than doing the job manually.

Log in using SSH. Stop any databases and other applications that will dislike suddenly losing filesystem access. Then use the kernel's Magic SysRq feature to force the system read-only, make the change, and reboot.

Code: Select all

sudo -i
echo u > /proc/sysrq-trigger 
echo s > /proc/sysrq-trigger 
tune2fs -O ^has_journal /dev/mmcblk0p2
e2fsck -fy /dev/mmcblk0p2
echo s > /proc/sysrq-trigger 
echo b > /proc/sysrq-trigger
I have tested this on one of my Raspbian systems, and it seems to go okay.

sirko
Posts: 4
Joined: Wed Oct 19, 2016 1:56 pm

Re: Disabling ext4 journaling remote

Fri Oct 21, 2016 2:22 pm

Thank you, jojopi.
Exactly what I was looking for.

And now I know, why machine did not reboot. Forgot the y for fsck...

ubnt
Posts: 3
Joined: Mon Nov 20, 2017 11:20 am

Re: Disabling ext4 journaling remote

Mon Nov 20, 2017 11:27 am

I tried the command "tune2fs -O ^has_journal /dev/mmcblk0p" on my Raspberry Pi 3 and got the following error.

Attempt to read block from filesystem resulted in short read while
trying to open "location address" Could this be a zero-length partition?

Any ideas on why I got that error message? And any other recommendations for disabling journaling?

DirkS
Posts: 10882
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Disabling ext4 journaling remote

Mon Nov 20, 2017 1:05 pm

ubnt wrote:
Mon Nov 20, 2017 11:27 am
I tried the command "tune2fs -O ^has_journal /dev/mmcblk0p" on my Raspberry Pi 3 and got the following error.
You're missing the '2'. It's /dev/mmcblk0p2

ubnt
Posts: 3
Joined: Mon Nov 20, 2017 11:20 am

Re: Disabling ext4 journaling remote

Mon Nov 20, 2017 3:46 pm

I checked my drivers by df command.

/dev/mmcb1k0p6 of /boot
/dev/mmcb1k0p5 of /media/pi/settings

Could you please share which one I should use 5 or 6?

fruitoftheloom
Posts: 27225
Joined: Tue Mar 25, 2014 12:40 pm

Re: Disabling ext4 journaling remote

Mon Nov 20, 2017 3:57 pm

ubnt wrote:
Mon Nov 20, 2017 3:46 pm
I checked my drivers by df command.

/dev/mmcb1k0p6 of /boot
/dev/mmcb1k0p5 of /media/pi/settings

Could you please share which one I should use 5 or 6?

Have you used NoobS to install Raspbian ??
Take what I advise as advice not the utopian holy grail, and it is gratis !!

ubnt
Posts: 3
Joined: Mon Nov 20, 2017 11:20 am

Re: Disabling ext4 journaling remote

Tue Nov 21, 2017 5:52 am

I reinstalled the OS from Noobs.

Any help? I am running a Ubiquiti Controller on Raspberry Pi 3 Model B and want to increase the life of my SD card.

bl1rt
Posts: 1
Joined: Fri Sep 11, 2020 8:39 pm

Re: Disabling ext4 journaling remote

Fri Sep 11, 2020 8:44 pm

Amazing solution, jojopi! Worked like a charm, when I thought it couldn't be done at all. Mad props and thanks much!

Return to “Raspberry Pi OS”