FSDB(8)
π FSDB β the FFS debugging/editing tool, bestie β¨
Okay so first things first: this is fsdb from the System Manager's Manual, and we're about to get deep into file system surgery. Buckle up, bestie. π
π¦ SYNOPSIS
fsdb [-d] [-f] [-r] fsname
πΈ DESCRIPTION
So like, the fsdb utility opens fsname (usually a raw disk partition, no cap) and runs a command loop that lets you mess with the file system's inode data. It's giving main character energy for file system repair. π
You get prompted to enter a command with fsdb (inum X)> where X is the currently selected i-number. The initial selected inode is the root of the file system (i-number 2). Iconic starting point, honestly. β¨
The command processor uses the editline(3) library, so you can use command line editing to reduce typing if desired β lowkey a lifesaver. When you exit the command loop, the file system superblock is marked dirty and any buffered blocks are written to the file system. Slay. π
The following options are available:
β¨ OPTIONS β¨
-dβ Enable additional debugging output (which comes primarily fromfsck(8)-derived code). It's giving verbose mode, and we stan. π₯-fβ Left for historical reasons and has no meaning. Literally just vibes at this point. π-rβ Open the file system read/only, and disables all commands that would write to it. Safety first, bestie! π«Ά
π COMMANDS π
Besides the built-in editline(3) commands, fsdb supports these commands:
helpβ Print out the list of accepted commands. Your bestie when you're lost. π§inodei-number β Select inode i-number as the new current inode. It's giving navigation, periodt. βbackβ Revert to the previously current inode. Undo button but make it Unix. πclrii-number β Clear i-number. Bye bestie, you're cleared. πlookupname /cdname β Find name in the current directory and make its inode the current inode. Name may be a multi-component name or may begin with slash to indicate that the root inode should be used to start the lookup. If some component along the pathname is not found, the last valid directory encountered is left as the active inode. This command is valid only if the starting inode is a directory. It's giving follow the path, iykyk. π¦active/printβ Print out the active inode. Main character reveal. πblocksβ Print out the block list of the active inode. Note that the printout can become long for large files, since all indirect block pointers will also be printed. It's giving receipts, and they're LONG. πfindblkdisk_block_number ... β Find the inode(s) owning the specified disk block(s) number(s). Note that these are not absolute disk blocks numbers, but offsets from the start of the partition. Detective mode: activated. πuplinkβ Increment the active inode's link count. Go up, bestie! πdownlinkβ Decrement the active inode's link count. And down we go. πlinkcountnumber β Set the active inode's link count to number. You're in control. πlsβ List the current inode's directory entries. This command is valid only if the current inode is a directory. The way that this just works, obsessed. β¨rmname /delname β Remove the entry name from the current directory inode. This command is valid only if the current inode is a directory. Not me deleting entries, periodt. πlnino name β Create a link to inode ino under the name name in the current directory inode. This command is valid only if the current inode is a directory. Linking besties together! π«Άchinumdirslot inum β Change the i-number in directory entry dirslot to inum. Swap it, slay. π₯chnamedirslot name β Change the name in directory entry dirslot to name. This command cannot expand a directory entry. You can only rename an entry if the name will fit into the existing directory slot. No cap: size matters here. πchtypetype β Change the type of the current inode to type. Type may be one of:file,dir,socket, orfifo. Glow-up for your inode. πchmodmode β Change the mode bits of the current inode to mode. You cannot change the file type with this subcommand; usechtypeto do that. Respect the distinction, bestie. β¨chflagsflags β Change the file flags of the current inode to flags. Flag it up! π©chownuid β Change the owner of the current inode to uid. New owner, new era. πchgrpgid β Change the group of the current inode to gid. Group chat reassignment. π¬chgengen β Change the generation number of the current inode to gen. Gen Z energy for generation numbers. π¦btimetime /mtimetime /ctimetime /atimetime β Change the creation (birth), modification, change, or access time (respectively) on the current inode to time. Time should be in the formatYYYYMMDDHHMMSS[.nsec]wherensecis an optional nanosecond specification. If no nanoseconds are specified, thebirthnsec,mtimensec,ctimensec, oratimensecfield will be set to zero. Note thatbtimeis available on UFS2 file systems only. Time travel, but make it file systems. β°quit,q,exit,<EOF>β Exit the program. Bye bestie, see you never (until next time). ππ
π SEE ALSO
editline(3), fs(5), clri(8), fsck(8) β go read these too, bestie. iykyk. π
π HISTORY
The fsdb utility appeared in 4.3BSD-Tahoe. It used the source code for fsck(8) to implement most of the file system manipulation code. The remainder of fsdb appeared in NetBSD 1.1 written by John T. Kohl. It first appeared in FreeBSD 2.1.5 ported by Peter Wemm. It's giving legacy, and we respect the heritage. π
π BUGS
- Manipulation of ``short'' symlinks has no effect. In particular, one should not try changing a symlink's type. It's giving undefined behavior, and not the cute kind. π
- You must specify modes as numbers rather than symbolic names. No symbolic shortcuts, bestie. π’
- There are a bunch of other things that you might want to do which
fsdbdoes not implement. It's giving limitations, and we simply must accept them. π
β οΈ WARNING
Use this tool with extreme caution--you can damage an FFS file system beyond whatfsck(8)can repair. This is NOT a drill, bestie. You can literally break your file system so hard thatfsck(8)can't even save you. Be careful out there. ππ₯
This iconic manual page comes from the Debian project, dated October 3, 2016. Stay safe out there doing your file system edits, bestie! π«Άπβ¨
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 1995 John T. Kohl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms