How to get the name of a piece having its file

I’ve got 11261 pieces in “lost+found”. I started the node after running efsck and the Audit score was oscillating between 90% and 100%. Data on the disk occupy 1.3Terabyte.

If the Audit score drop too much (I don’t know how much) your node could be disqualified.

You can restore your files faster if you generate a shell script that will copy or move the files from the “last+found” directory to their original pathes.

You can try to modify line 77 of the python script so that the output for each file will be a copy or a move command. For example, instead of having for each file the output:
“File lost+found/#92559603 should probably go do ukfu6bhbboxilvt7jrwlqk7y2tapb5d2r2tsmj2sjxvw5qaaaaaa/y5/a7ok7l6xcujgiudtnpo6a2bnu5lptbe35je2n5khp5isi43tqq.sj1”
you will get:
“cp your_PATH_lost+found/#100010469 PATH_TO_BLOBS/pmw6tvzmf2jv6giyybmmvl4o2ahqlaldsaeha4yx74n5aaaaaaaa/7w/f2xfjrqkmlooj5sbp6hougk7jjpssdl36rxfvitanfc7xsoyaq.sj1”

After modifying the script, assign the lost+found path to the variable files_to_scan (line 8 of the script)
files_to_scan = ‘your_PATH_lost+found/*’

Run the script and redirect the output to a file:
python3 script > file.sh

Open the file.sh. Its content will be for example:

“cp your_PATH_lost+found/#124399501 PATH_TO_BLOBS/ukfu6bhbboxilvt7jrwlqk7y2tapb5d2r2tsmj2sjxvw5qaaaaaa/f7/7elfswbyhvzmtfdiqpmf6nkeiejcrnpqsah2gweltaf3oywd5a.sj1”
“cp your_PATH_lost+found/#96482641 PATH_TO_BLOBS/ukfu6bhbboxilvt7jrwlqk7y2tapb5d2r2tsmj2sjxvw5qaaaaaa/f7/rqangqph5c7sijetp4pnirwsb675cnl4ma2k2ute2j4zen3lsa.sj1”
“cp your_PATH_lost+found/#96618903 PATH_TO_BLOBS/ukfu6bhbboxilvt7jrwlqk7y2tapb5d2r2tsmj2sjxvw5qaaaaaa/f7/vu4orqxzfmw7wqkw4y2yi27cl7qkik3p244oacgu75bjenw2ma.sj1”
“cp your_PATH_lost+found/#113003688 PATH_TO_BLOBS/ukfu6bhbboxilvt7jrwlqk7y2tapb5d2r2tsmj2sjxvw5qaaaaaa/gl/efl254eueb5qi42m5d4jkiuhjtnqcmougly7ybqr47ieejlwsa.sj1”
“cp your_PATH_lost+found/#96397789 PATH_TO_BLOBS/ukfu6bhbboxilvt7jrwlqk7y2tapb5d2r2tsmj2sjxvw5qaaaaaa/gl/gqqcogdpzwdzeyqaorysbnucgzlu3pmbkzixfs43rlv3c73f2q.sj1”

Insert at top the line:
#!/bin/bash

Close the file and change the access permission:
chmod u+x file.sh

Run the file:
./file.sh

After running, all the files in “lost+found” directory are copied or moved (depending on the command chosen) to their pathes.

2 Likes