Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F41807890
mount-error.sh
pho (Peter Holm)
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
pho
May 16 2022, 1:05 PM
2022-05-16 13:05:36 (UTC+0)
Size
995 B
Referenced Files
None
Subscribers
None
mount-error.sh
View Options
#!/bin/sh
[
`
id
-u
`
-ne
0
]
&&
echo
"Must be root!"
&&
exit
1
mntpoint
=
/mnt
mdstart
=
10
newfs_flags
=
'-U'
set
-e
u1
=
$mdstart
u2
=
$((
mdstart
+
1
))
mp1
=
${
mntpoint
}
$u1
mp2
=
${
mntpoint
}
$u2
mkdir
-p
$mp1
$mp2
diskimage
=
$mp1
/fsck8.sh.diskimage
max
=
$((
10
*
1024
*
1024
))
[
"
$newfs_flags
"
=
"-j"
]
&&
max
=
$((
20
*
1024
*
1024
))
mount
|
grep
"on
$mp1
"
|
grep
-q
/dev/md
&&
umount
-f
$mp1
[
-c
/dev/md
$u1
]
&&
mdconfig
-d
-u
$u1
mdconfig
-a
-t
swap
-s
1g
-u
$u1
newfs
$newfs_flags
-n
/dev/md
$u1
>
/dev/null
mount
/dev/md
$u1
$mp1
[
-c
/dev/md
$u2
]
&&
mdconfig
-d
-u
$u2
dd
if
=
/dev/zero
of
=
$diskimage
bs
=
$max
count
=
1
status
=
none
mdconfig
-a
-t
vnode
-f
$diskimage
-u
$u2
backups
=
`
newfs
-N
$newfs_flags
md
$u2
|
grep
-A1
"super-block backups"
|
\
tail
-1
|
sed
's/,//g'
`
newfs
$newfs_flags
md
$u2
dumpfs
/dev/md
$u2
|
head
-24
mount
/dev/md
$u2
$mp2
||
exit
1
[
-d
/usr/include/sys
]
&&
cp
-r
/usr/include/sys
$mp2
umount
$mp2
mdconfig
-d
-u
$u2
umount
$mp1
mdconfig
-d
-u
$u1
rm
-f
/tmp/flip
exit
$s
File Metadata
Details
Attached
Mime Type
text/x-shellscript
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4766236
Default Alt Text
mount-error.sh (995 B)
Attached To
Mode
D35219: Comprehensive UFS/FFS superblock integrity checks made when a superblock is read
Attached
Detach File
Event Timeline
Log In to Comment