- Вопрос по команде ln. Что пропустил?
- Re: Вопрос по команде ln. Что пропустил?
- Re: Вопрос по команде ln. Что пропустил?
- Re: Вопрос по команде ln. Что пропустил?
- Re: Вопрос по команде ln. Что пропустил?
- Re: Вопрос по команде ln. Что пропустил?
- Re: Вопрос по команде ln. Что пропустил?
- Re: Вопрос по команде ln. Что пропустил?
- Re: Вопрос по команде ln. Что пропустил?
- Re: Вопрос по команде ln. Что пропустил?
- Re: Вопрос по команде ln. Что пропустил?
- Re: Вопрос по команде ln. Что пропустил?
- Re: Вопрос по команде ln. Что пропустил?
- Жесткие ссылки
- Re: Вопрос по команде ln. Что пропустил?
- Invalid cross-device link while Hardlinking in the same file system
- 4 Answers 4
- Invalid cross-device link error preventing logging of images #1252
- Comments
- timothybrooks commented Sep 22, 2020
- Description
- What I Did
- issue-label-bot bot commented Sep 22, 2020
- tyomhak commented Sep 22, 2020
- vanpelt commented Sep 22, 2020
- timothybrooks commented Sep 22, 2020
- timothybrooks commented Sep 22, 2020
- Почему я не могу создать жесткую ссылку из файла устройства в каталоге, отличном от /dev?
- 2 ответа
- Arch Linux
- #1 2015-07-09 07:52:04
- [SOLVED]ip r g error: «RTNETLINK answers: Invalid cross-device link»
- #2 2015-07-20 23:09:48
- Re: [SOLVED]ip r g error: «RTNETLINK answers: Invalid cross-device link»
Вопрос по команде ln. Что пропустил?
Необходимо создать жесткую ссылку с директории /var/log/ на /mailstorage/mailarchive/
Пишу: ln -d /var/log/ /mailstorage/mailarchive/
выдает Следующее: ln: creating hard link `/mailstorage/mailarchive/log’ => `/var/log/’: Invalid cross-device link
Директории находятся в разделах на разных жестких дисках.
Что я и где пропустил?
Re: Вопрос по команде ln. Что пропустил?
Re: Вопрос по команде ln. Что пропустил?
а что жесткую ссылку создать не получится?
Re: Вопрос по команде ln. Что пропустил?
жёсткие только на одном разделе
Re: Вопрос по команде ln. Что пропустил?
И если я правилно понимаю, то файлы будут писаться и туда и туда. а это не есть то, что нужно. просто на варе место закончилось.
Re: Вопрос по команде ln. Что пропустил?
файлы будут писаться туда куда ссылка символическая указывает 🙂 в саму ссылку не будут 🙂
Re: Вопрос по команде ln. Что пропустил?
ага. то есть ситуация.
Надо: перенести /var/log/ на другой раздел (не перегружая комп) на другой раздел. Для этого:
1. переместить (mv) /var/log на другой раздел. 2. Создать ссылку из другого раздела на /var/log (ln -sd /mailstorage/mailarhive/log /var)
Re: Вопрос по команде ln. Что пропустил?
А что у тебя в /var/log только логи почты?:)
Вообще я так понимаю, что примерно так:
init 1
rsync -a /var/log/ /other/path/log
rm -fr /var/log/
ln -s /other/path/log /var/log
mv /var/log/biglogfiles /other/path/
ln -s /other/path/biglogfile1 /var/log
ln -s /other/path/biglogfile2 /var/log
Re: Вопрос по команде ln. Что пропустил?
>А что у тебя в /var/log только логи почты?:)
нет есть еще немного, но в основном, да.. почта.
на файлы я думал ссылки сделать, но там еще старые логи идут ежедневно в архив. в итоге выходит log.file log.file.1 log.file.1.gz log.file.2.gz . и т.д. все это делает хитрожопый скрипт, в котором разбираться желания нет. итак что, имхо легче и быстрее дернуть всю директорию.
Re: Вопрос по команде ln. Что пропустил?
#cp /var/log/ /mailstorage/mailarchive/
#mv /var/log/ /var/log1
#ln -ds /mailstorage/mailarchive/log/ /var
#rm -rf /var/log1
В общем сделал так. надеюсь сработает.
Re: Вопрос по команде ln. Что пропустил?
Лучше не удалять, а переименовать, или переместить куда-нибудь в /tmp, если он находится на одном разделе с /var/log. Тогда можно избежать init 1, ограничившись просто поочерёдным перезапуском демонов, пишущих в /var/log.
Re: Вопрос по команде ln. Что пропустил?
> В общем сделал так. надеюсь сработает.
Посмотри права в /mailstorage/mailarchive/log/
Re: Вопрос по команде ln. Что пропустил?
Жесткие ссылки
Жесткие ссылки живут строго в пределах одного раздела. Нормальное объяснение есть в книжке по юниксу.
Краткое объяснение таково: данные о файле (права, флаги, размещение секторов на диске) хранятся в структуре, называемой inode. Директория — таблица вида (номер inode, имя). Хардлинк — это просто другое имя с тем же inode (убедитесь при помощи ls -i). Нумерация inode на каждом разделе своя. Номер устройства в директории не предусмотрен, ибо возникает слишком много головной боли (например, при монтировании/отмонтировании).
Re: Вопрос по команде ln. Что пропустил?
Права проверил. Syslog перезапустил. Вроде все работает.
Источник
Invalid cross-device link while Hardlinking in the same file system
I have /home/myuser/Desktop/rc/.netrc file that i want hardlink to /root, ie home directory of root user. When i do:
ln /home/user/Destkop/rc/.netrc /root
it gives the following error:
ln: creating hard link /root/.netrc’ => .netrc’: Invalid cross-device link
but it works when i hardlink the file to myuser‘s home, ie to /home/myuser.
So, what’s the problem, why it says invalid cross-devices when there is only one file system here?
PS. I am using RHEL6
4 Answers 4
it’s most likely that your /home directory isn’t on the same partition as the /root directory.
You can easily check this with cat /etc/fstab hardlinks cannot be created between different partitions, only symlinks can.
It seem to me the BEST way is NOT to use a HARD link but to use a symbolic link instead. You’ll find it to be far less of a hassle and things work just fine. Hard link have some interesting problems if you are not aware of them.
See man ln and checkout the -s option!
Please in general use symbolic links instead of HARD links.
Probably, earlier a symlinked folder was replaced by its real destination folder on source. And now your backup script fails.
file systems like ext3/ext4 uses i-nodes to store file meta-data (mode, atime, ctime, mtime, uid, gid, size, links_count, acl etc.)
i-node table is a linear array of struct ext4_inode. this struct ext4_inode has field i_links_count. that refers to hard link count.
whenever new hard link to file is created this link_count value of that files i-node is incremented.
ls -l /home/raju/test.sh
-rwxrwxrwx 2 raju raju 287 Aug 23 23:19 /home/raju/test.sh
here 2 is link count.
different volumes have different i-node tables.
directory is flat file that maps file names to an i-node number on the filesystem.
directory entries across the filesystem that reference the same i-node number—these are known as hard links.
directory entry of one filesystem (volume1) can not reference i-node which is on different filesystem (volume2).
so ln fails with invalid cross-device link error.
but you can always create symbolic links to files on different filesystems/ volumes.
symlinks do not use i-node to reference file they use file path names. check link target of symlink.
Источник
Invalid cross-device link error preventing logging of images #1252
Comments
timothybrooks commented Sep 22, 2020
wandb, version 0.10.2
Python 3.7.8
Linux
Description
When trying to log images with W&B, I am getting an error that prevents the temp image file from being copied, which prevents logging and causes the job to crash.
What I Did
Calling «wandb.log(. ) on an wandb.Image(. )` object, I get the following error:
The text was updated successfully, but these errors were encountered:
issue-label-bot bot commented Sep 22, 2020
Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.90. Please mark this comment with 👍 or 👎 to give our bot feedback!
tyomhak commented Sep 22, 2020
Hey @timothybrooks, thanks for reporting. @vanpelt can you please help here?
vanpelt commented Sep 22, 2020
Hey @timothybrooks wandb.Image writes the data to your system temp directory and links them to your folder if symlinks are supported. Your system is unable to link between the underlying storage on /tmp vs your home directory. The simplest solution is to put your wandb directory into your system temp directory. You can do this by setting the dir argument of wandb.init to /tmp .
timothybrooks commented Sep 22, 2020
Hmm I see. I had been using it fine in prior versions of wandb with my system, and other applications seem to be copying from /tmp successfully, although its possible that something changed on the side of our cluster. Oddly, it occasionally works for the first few images before throwing this error. Do you know why that might occur?
I would prefer to not store my logs on /tmp since those eventually get automatically removed and it would be a hassle for me to need to sync them. Any other options? Perhaps there is instead a way to specify a different temp directory (on the same filesystem) to use for these images to ensure they can be moved to my run directory?
timothybrooks commented Sep 22, 2020
Here is a full stack trace in case this helps. Perhaps there was an issue writing the image into /tmp in the first place?
Источник
Почему я не могу создать жесткую ссылку из файла устройства в каталоге, отличном от /dev?
Когда я захотел создать жесткую ссылку в моем каталоге /home в режиме root , Linux показал следующее сообщение об ошибке:
Ниже приведено сообщение об ошибке:
Но я мог создать только жесткую ссылку в каталоге /dev , и это было невозможно в других каталогах.
Теперь я хочу знать, как создать жесткую ссылку из существующего файла устройства (например, sdb1 ) в /home (или другие каталоги)?
2 ответа
Но я мог только создать жесткую ссылку в каталоге /dev, и это было невозможно в других каталогах.
Как показано в сообщении об ошибке, невозможно создать жесткую ссылку для разных файловых систем; вы можете создавать только мягкие (символические) ссылки.
Например, если ваш /home находится в другом разделе, чем ваш корневой раздел, вы не сможете жестко связать —- +: = 1 =: + —- до /tmp/foo .
Теперь, как отметил @RichardNeumann, /home/user/ обычно монтируется как файловая система devtmpfs. См. Этот пример:
Поэтому вы можете создавать жесткие ссылки на файлы в [[email protected]
]$ df Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/centos_centos7-root 46110724 3792836 42317888 9% / devtmpfs 4063180 0 4063180 0% /dev tmpfs 4078924 0 4078924 0% /dev/shm tmpfs 4078924 9148 4069776 1% /run tmpfs 4078924 0 4078924 0% /sys/fs/cgroup /dev/sda1 1038336 202684 835652 20% /boot tmpfs 815788 28 815760 1% /run/user/1000 внутри /dev .
Жесткие ссылки просто создают другую запись в каталоге, указывая на файл (где файл — это файл, такой как вещь, например каталог). Поэтому жесткие ссылки не могут ссылаться на файл в другой файловой системе.
Софт-ссылки в этом случае вы друг. Используйте ln -s . Софтлинки могут проходить через файловые системы и даже указывать на то, чего там нет.
Источник
Arch Linux
You are not logged in.
#1 2015-07-09 07:52:04
[SOLVED]ip r g error: «RTNETLINK answers: Invalid cross-device link»
I’m trying to get ssh traffic to be accepted by my computer while connected to a VPN. I was having some issues with iproute2 so I was trying to use
command to emulate the route an ssh packet takes.
When the computer is not connect to the VPN the output is:
When the computer is connect I get the follow error:
I couldn’t really find a good answer on the internet on what causes this erro and I was wondering if I could get some insight as to what causes this error. I assume it is an issue in the main routing table, but I don’t see what it is. Here is the output from the main ip routing table:
I’m not sure if the local table is of any help because it is handle by the kernel but here it just in case it helps:
Any help on diagnosing why this error occurs would be appreciated?
Last edited by CyberGhost (2015-07-21 00:36:49)
#2 2015-07-20 23:09:48
Re: [SOLVED]ip r g error: «RTNETLINK answers: Invalid cross-device link»
I solved my issue. The reason the packets were being dropped was because by default the Linux kernel checks to see the path a hypothetical return packet would take. If the return packet is over another interface it silently dropped. This mechanism is controlled by the rp_filter kernel parameter.
There are two solutions the to the problem.
First (this is the solution I used) is to change the rp_filter parameter to 0:
Run the following command to the list the rp_filter parameters:
Then change all the relevant entry to 0 using the following sample command
After using this method you will likely have to create a ip route for return traffic to be returned out the correct interface. In my case a create a iptables rule that marked ssh packets over port 22 and then had marked packets routed to a seperate routing table using these commands:
x.x.x.x is your default gateway, y.y.y.y/y is your local subnet, and replace enp9s0 with the non-VPN interface you wish to use.
A second possible solution that avoids changing kernel parameters:
This solution came from this forum thread.
This solution involves creating a seperate routing table from the main, that routes all traffic over the regular ethernet interface. Then a rule is created that applies to all traffic from your local ethernet IP address and directs it to the new routing table.. Now when the kernel checks if a hypothetical return packet will be returned over the same interface, it will and the packet won’t be dropped. This makes change the kernel parameter unneccassary. The disadvantage with this method is it apply to all types of traffic. I also think this method could cause traffic to be leaked from the VPN unintentionally and could compromise your identity, but I’m not sure.
Anyway the commands for this method is:
x.x.x.x is your default gateway, y.y.y.y/y is your default subnet, and z.z.z.z is your local IP.
I hope this helps anyone who comes across an issue like this in the future.
Источник