LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 05-14-2023, 04:25 PM   #1
martixy
LQ Newbie
 
Registered: May 2023
Posts: 9

Rep: Reputation: 0
Error when placing XFS journal on external device


Greetings good folks. I find myself in need of some deep linux voodoo.

My life story: I recently got some drives and repurposed some spare parts as a NAS. I decided that is the perfect excuse to properly get into linux. I have used linux only peripherally before, in my web dev job - a few terminal commands here and there, some light server admin. Starting from the ground up has been fun so far.

I was researching what filesystem to put on my hard drives - I have 2 18TB ones, intended for data and parity (using snapraid).

I wanted to try XFS.

One feature of xfs is that apparently you can put the journal on a different device. This would certainly save some iops and improve perf on spinning rust.

Code:
sudo mkfs.xfs -N -l logdev=/mnt/data-journal/journal,size=100m /dev/sdc
However I have ran into the following error:
Quote:
size 100m specified for log subvolume is too large, maximum is 0 blocks
Alternatively, if no size is specified: unable to get size of the log subvolume.

I have ubuntu 22.04 LTS.
First I tried this on xfsprogs v5.13.0
Then I considered maybe this version had a bug and compiled v6.2.0 from source (another first for me).
The error did not go away.

The log's destination is the boot drive (which is an SSD). It's formatted with btrfs if that makes any difference (and the target is a subvolume I made just for the log).
Also, something else that might be relevant - log drive is 512b sectors, hard drives are 4K sectors (no really 4K).

Bonus:
Code:
sudo mkfs.xfs -N -l logdev=/dev/sdb,size=512m /dev/sdc
gives the following: Warning: the log subvolume sector size 512 is less than the sector size reported by the device (4096).
So trying to put it on the other hdd works (save for the warning). The only difference between both commands are
a) The target is a file in one instance and a device in the other.
b) Sector sizes are different.

Last edited by martixy; 05-14-2023 at 04:30 PM.
 
Old 05-15-2023, 04:25 AM   #2
martixy
LQ Newbie
 
Registered: May 2023
Posts: 9

Original Poster
Rep: Reputation: 0
I figured out the problem.

The file needs to be pre-allocated.
Aka sudo truncate -s 256m /mnt/xfs-journal/data-journal
(I'm new to linux so this was not at all obvious to me.)

I created the filesystem.
But of course now there's another problem. Because of course there is...

Code:
sudo mount -t xfs -o logdev=/mnt/xfs-journal/data-journal /dev/sdb1 /mnt/data
Quote:
/mnt/data: the kernel does not recognize /dev/sdb1 as a block device; maybe "modprobe driver" is necessary.
 
Old 05-15-2023, 05:35 AM   #3
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,639

Rep: Reputation: Disabled
Well, I'm certainly no expert here. But you mentioned that the journal is supposed to reside on a btrfs partition. These are called subvolumes in btrfs syntax and are addressed with names containing an @. You might want to read up on that. Sorry to be not more specific but I simply don't know enough about all this, still, just maybe it could help...
 
Old 05-15-2023, 06:20 AM   #4
martixy
LQ Newbie
 
Registered: May 2023
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by JZL240I-U View Post
Well, I'm certainly no expert here. But you mentioned that the journal is supposed to reside on a btrfs partition. These are called subvolumes in btrfs syntax and are addressed with names containing an @. You might want to read up on that. Sorry to be not more specific but I simply don't know enough about all this, still, just maybe it could help...
For one, I don't think that's true.

But even then, I tried putting the log on a different drive (which was formatted with a working xfs itself). Same error.

If I point it to a block device it mounts:
Code:
sudo mount -t xfs -o logdev=/dev/sda1 /dev/sdb1 /mnt/data
If I point it to a file, it does not mount:
Code:
sudo mount -t xfs -o logdev=/mnt/xfs-journal/data-journal /dev/sdb1 /mnt/data

Last edited by martixy; 05-15-2023 at 06:22 AM.
 
Old 05-15-2023, 07:27 AM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 26,758

Rep: Reputation: 6318Reputation: 6318Reputation: 6318Reputation: 6318Reputation: 6318Reputation: 6318Reputation: 6318Reputation: 6318Reputation: 6318Reputation: 6318Reputation: 6318
I don't know much about the internal workings of xfs either but it would not make sense a log device would be a file. The driver would be calling another filesystem with its own metadata and journal. A separate partition as the log device does make sense.
 
1 members found this post helpful.
Old 05-15-2023, 10:07 AM   #6
lvm_
Senior Member
 
Registered: Jul 2020
Posts: 1,525

Rep: Reputation: 523Reputation: 523Reputation: 523Reputation: 523Reputation: 523Reputation: 523
Well, yes, device and file are not the same and are not interchangeable, and xfs man page explicitly states that a device is needed for logdev - why the surprise? Incidentally, have you ever heard of loop devices? :)
 
1 members found this post helpful.
Old 05-15-2023, 11:18 AM   #7
martixy
LQ Newbie
 
Registered: May 2023
Posts: 9

Original Poster
Rep: Reputation: 0
I know you can make filesystems inside files. But yea, I eventually arrived at the same conclusion and made a separate partition for it.

Thank you tho! I'm new, but I'm learning.
 
Old 05-15-2023, 01:30 PM   #8
lvm_
Senior Member
 
Registered: Jul 2020
Posts: 1,525

Rep: Reputation: 523Reputation: 523Reputation: 523Reputation: 523Reputation: 523Reputation: 523
Loop devices are not for making filesystems in files, they are for making block devices in files, and then you can use these devices for filesystems, yes, but also for xfs journals.
 
1 members found this post helpful.
Old 05-16-2023, 10:09 AM   #9
martixy
LQ Newbie
 
Registered: May 2023
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by lvm_ View Post
Loop devices are not for making filesystems in files, they are for making block devices in files, and then you can use these devices for filesystems, yes, but also for xfs journals.
Oh! Neat.

I will read up on that. Thank you!
 
Old 05-17-2023, 01:04 PM   #10
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,639

Rep: Reputation: Disabled
Quote:
Originally Posted by martixy View Post
For one, I don't think that's true.
Okay. All other more relevant posts aside, this is my /etc/fstab of an openSuse tumbleweed on btrfs:
Code:
UUID=8ff0da0e-4339-4eb8-9090-088b8e646a01  /                       btrfs  defaults                      0  0
UUID=8ff0da0e-4339-4eb8-9090-088b8e646a01  /var                    btrfs  subvol=/@/var                 0  0
UUID=8ff0da0e-4339-4eb8-9090-088b8e646a01  /usr/local              btrfs  subvol=/@/usr/local           0  0
UUID=8ff0da0e-4339-4eb8-9090-088b8e646a01  /srv                    btrfs  subvol=/@/srv                 0  0
UUID=8ff0da0e-4339-4eb8-9090-088b8e646a01  /root                   btrfs  subvol=/@/root                0  0
UUID=8ff0da0e-4339-4eb8-9090-088b8e646a01  /opt                    btrfs  subvol=/@/opt                 0  0
UUID=8ff0da0e-4339-4eb8-9090-088b8e646a01  /home                   btrfs  subvol=/@/home                0  0
UUID=8ff0da0e-4339-4eb8-9090-088b8e646a01  /boot/grub2/x86_64-efi  btrfs  subvol=/@/boot/grub2/x86_64-efi  0  0
UUID=8ff0da0e-4339-4eb8-9090-088b8e646a01  /boot/grub2/i386-pc     btrfs  subvol=/@/boot/grub2/i386-pc  0  0
UUID=8ff0da0e-4339-4eb8-9090-088b8e646a01  /.snapshots             btrfs  subvol=/@/.snapshots          0  0
UUID=7c5b0e30-2117-4c1a-abde-b38953b49a06  swap                    swap   defaults                      0  0
UUID=D1CD-79A5                             /boot/efi               vfat   utf8                          0  2
#/dev/sda1                                  /backup                 ext4   defaults                      0  2
UUID=792fc662-3296-4884-8743-4868ce71f55c  /backup                 ext4   defaults                      0  2
You can draw your own conclusions...
 
Old 05-27-2023, 10:13 AM   #11
martixy
LQ Newbie
 
Registered: May 2023
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by JZL240I-U View Post
Okay. All other more relevant posts aside, this is my /etc/fstab of an openSuse tumbleweed on btrfs:
Code:
UUID=8ff0da0e-4339-4eb8-9090-088b8e646a01  /                       btrfs  defaults                      0  0
UUID=8ff0da0e-4339-4eb8-9090-088b8e646a01  /var                    btrfs  subvol=/@/var                 0  0
UUID=8ff0da0e-4339-4eb8-9090-088b8e646a01  /usr/local              btrfs  subvol=/@/usr/local           0  0
UUID=8ff0da0e-4339-4eb8-9090-088b8e646a01  /srv                    btrfs  subvol=/@/srv                 0  0
UUID=8ff0da0e-4339-4eb8-9090-088b8e646a01  /root                   btrfs  subvol=/@/root                0  0
UUID=8ff0da0e-4339-4eb8-9090-088b8e646a01  /opt                    btrfs  subvol=/@/opt                 0  0
UUID=8ff0da0e-4339-4eb8-9090-088b8e646a01  /home                   btrfs  subvol=/@/home                0  0
UUID=8ff0da0e-4339-4eb8-9090-088b8e646a01  /boot/grub2/x86_64-efi  btrfs  subvol=/@/boot/grub2/x86_64-efi  0  0
UUID=8ff0da0e-4339-4eb8-9090-088b8e646a01  /boot/grub2/i386-pc     btrfs  subvol=/@/boot/grub2/i386-pc  0  0
UUID=8ff0da0e-4339-4eb8-9090-088b8e646a01  /.snapshots             btrfs  subvol=/@/.snapshots          0  0
UUID=7c5b0e30-2117-4c1a-abde-b38953b49a06  swap                    swap   defaults                      0  0
UUID=D1CD-79A5                             /boot/efi               vfat   utf8                          0  2
#/dev/sda1                                  /backup                 ext4   defaults                      0  2
UUID=792fc662-3296-4884-8743-4868ce71f55c  /backup                 ext4   defaults                      0  2
You can draw your own conclusions...
My fstab

Code:
# UUID                                       <mount point>                <type>   <options>                 <dump> <pass>
UUID=bc3de0a4-933a-4880-a5cb-9b1b86ad495b    /mnt/rootfs-data1            btrfs    defaults,subvol=/         0      2
UUID=bc3de0a4-933a-4880-a5cb-9b1b86ad495b    /mnt/data1                   btrfs    defaults,subvol=/data     0      2
UUID=bc3de0a4-933a-4880-a5cb-9b1b86ad495b    /mnt/snapraid-content/data1  btrfs    defaults,subvol=/content  0      2
Your turn to draw conclusions.

------------------------------------------------------------
In any case, I attempted to use a loop device as a journal but could not get it to mount. It just says "unknown filesystem 'xfs_external_log'".
I don't know ¯\_(ツ)_/¯
I'm almost done setting up my system, so the time to play around for fun has kinda come to an end.
 
Old 05-27-2023, 11:27 AM   #12
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,639

Rep: Reputation: Disabled
That's a tough one. I guess those are either equivalents or the @-variant is something like access to directories. Got no real clue here...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to keep only one Systemd Journal log in /run/log/journal jegadezz Linux - Software 3 07-27-2016 06:24 AM
How to keep only one Systemd Journal log in /run/log/journal jegadezz Linux - Kernel 1 07-25-2016 01:00 PM
LXer: March 2014 Issue of Linux Journal: 20 Years of Linux Journal LXer Syndicated Linux News 0 03-04-2014 11:21 PM
journal rollforward failed: journal out of sync with zone-No DDNS plvasco Linux - Server 0 05-31-2013 07:45 PM
How to change an xfs journal from external to internal if the external log is gone rakan6 Linux - General 1 01-19-2011 05:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 02:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration