Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #204893

Re: Partition information as text file?

From <tomas@tuxteam.de>
Newsgroups linux.debian.user
Subject Re: Partition information as text file?
Date 2019-02-01 16:30 +0100
Message-ID <xmIVs-3eF-9@gated-at.bofh.it> (permalink)
References <xmHG2-2yT-9@gated-at.bofh.it> <xmHZn-2Fb-1@gated-at.bofh.it> <xmIC6-383-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Fri, Feb 01, 2019 at 09:00:06AM -0600, Richard Owlett wrote:
> On 02/01/2019 08:22 AM, Thomas Schmitt wrote:

[...]

> >So you need one or more scripts ... Then the script[s] would put out
> >the retrieved numbers in the text format which you desire.
> 
> The need for *ME* to write a script was a BASIC assumption to my
> asking about commands relevant to my task.

Perhaps the humble command "file" could be an ally in that. It's
not a complete solution, though...

Remember: "file" looks (with some exceptions, see below) into the
contents of a file and tries to find out what it is, by looking
for "magic numbers" (more precisely patterns) stored in a file
(/usr/share/misc/magic).

Here's a small session from my box (with some elisions marked as [...]

  tomas@trotzki:~$ mount
  /dev/sda1 on /boot type ext2 (rw,relatime,block_validity,barrier,user_xattr,acl)
  /dev/mapper/trotzki-root on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)
  /dev/mapper/trotzki-usr on /usr type ext4 (rw,relatime,data=ordered)
  /dev/mapper/trotzki-home on /home type ext4 (rw,relatime,data=ordered)
  /dev/mapper/trotzki-var on /var type ext4 (rw,relatime,data=ordered)
  [...]

(Note: my "partitions" are, with exception of /dev/sda1, which is the boot
partition, LVM volumes which are cut out from a physical volume which is
LUKS encrypted: I don't want someone to get at my (and my customer's)
data just because I leave the laptop in the metro).

Now:

  tomas@trotzki:~$ file /dev/mapper/trotzki-home 
  /dev/mapper/trotzki-home: symbolic link to ../dm-4

Ah.

  tomas@trotzki:~$ file /dev/dm-4
  /dev/dm-4: block special (254/4)

Not yet what we wanted. But:

  tomas@trotzki:~$ sudo file -s /dev/dm-4
  /dev/dm-4: Linux rev 1.0 ext4 filesystem data, UUID=c5d1ae98-df63-4c04-913d-661b82d38075 (needs journal recovery) (extents) (64bit) (large files) (huge files)

I guess that's not all info you want, but hey. Sudo is needed, because mere
mortals have no business in reading raw disks, usually; The "needs journal
recovery" sounds alarming, but remember that the thing is mounted, i.e.
active, so that's OK too.

Perhaps this can be a small building block for you.

I guess you'd like more info about the file system (size, what not).
Those commands (and their outputs!) are most probably file system
specific, as Thomas points out.

Cheers
-- t

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Partition information as text file? Richard Owlett <rowlett@cloud85.net> - 2019-01-26 15:40 +0100
  Re: Partition information as text file? David Wright <deblis@lionunicorn.co.uk> - 2019-01-26 18:10 +0100
  Re: Partition information as text file? Felix Miata <mrmazda@earthlink.net> - 2019-01-26 20:40 +0100
    Re: Partition information as text file? Richard Owlett <rowlett@cloud85.net> - 2019-01-26 22:20 +0100
      Re: Partition information as text file? "Alexander V. Makartsev" <avbetev@gmail.com> - 2019-01-26 23:00 +0100
      Re: Partition information as text file? Felix Miata <mrmazda@earthlink.net> - 2019-01-27 03:10 +0100
      Re: Partition information as text file? David Wright <deblis@lionunicorn.co.uk> - 2019-01-27 22:30 +0100
        Re: Partition information as text file? Richard Owlett <rowlett@cloud85.net> - 2019-01-28 13:50 +0100
          Re: Partition information as text file? Ionel Mugurel Ciobîcă <I.M.Ciobica@gmail.com> - 2019-01-28 16:50 +0100
          Re: Partition information as text file? Pascal Hambourg <pascal@plouf.fr.eu.org> - 2019-01-28 20:50 +0100
            Re: Partition information as text file? <tomas@tuxteam.de> - 2019-01-29 15:40 +0100
              Re: Partition information as text file? Richard Owlett <rowlett@cloud85.net> - 2019-01-29 16:30 +0100
                Re: Partition information as text file? <tomas@tuxteam.de> - 2019-01-29 16:40 +0100
                Re: Partition information as text file? "Thomas Schmitt" <scdbackup@gmx.net> - 2019-01-29 17:20 +0100
                Re: Partition information as text file? Richard Owlett <rowlett@cloud85.net> - 2019-01-31 15:20 +0100
                Re: Partition information as text file? "Thomas Schmitt" <scdbackup@gmx.net> - 2019-01-31 16:00 +0100
                Re: Partition information as text file? David Wright <deblis@lionunicorn.co.uk> - 2019-01-31 20:30 +0100
                Re: Partition information as text file? "Thomas Schmitt" <scdbackup@gmx.net> - 2019-01-31 21:10 +0100
                Re: Partition information as text file? Richard Owlett <rowlett@cloud85.net> - 2019-02-01 15:10 +0100
                Re: Partition information as text file? "Thomas Schmitt" <scdbackup@gmx.net> - 2019-02-01 15:30 +0100
                Re: Partition information as text file? Richard Owlett <rowlett@cloud85.net> - 2019-02-01 16:10 +0100
                Re: Partition information as text file? <tomas@tuxteam.de> - 2019-02-01 16:30 +0100
                Re: Partition information as text file? David Wright <deblis@lionunicorn.co.uk> - 2019-02-01 17:10 +0100
                Re: Partition information as text file? Pascal Hambourg <pascal@plouf.fr.eu.org> - 2019-02-01 19:40 +0100
                Re: Partition information as text file? <tomas@tuxteam.de> - 2019-02-01 22:30 +0100
                Re: Partition information as text file? David Wright <deblis@lionunicorn.co.uk> - 2019-02-01 17:20 +0100
                Re: Partition information as text file? Richard Owlett <rowlett@cloud85.net> - 2019-02-01 18:10 +0100
                Re: Partition information as text file? David Wright <deblis@lionunicorn.co.uk> - 2019-02-02 02:10 +0100
                Re: Partition information as text file? <tomas@tuxteam.de> - 2019-02-02 11:00 +0100
                Re: Partition information as text file? David Wright <deblis@lionunicorn.co.uk> - 2019-02-02 16:30 +0100
                Re: Partition information as text file? <tomas@tuxteam.de> - 2019-02-02 17:20 +0100
                Re: Partition information as text file? rhkramer@gmail.com - 2019-02-01 17:00 +0100
                Re: Partition information as text file? David Wright <deblis@lionunicorn.co.uk> - 2019-02-01 17:10 +0100
                Re: Partition information as text file? Felix Miata <mrmazda@earthlink.net> - 2019-02-01 17:20 +0100
                Re: Partition information as text file? David Wright <deblis@lionunicorn.co.uk> - 2019-02-01 17:30 +0100
                Re: Partition information as text file? Joe <joe@jretrading.com> - 2019-02-01 19:10 +0100
                Re: Partition information as text file? Greg Wooledge <wooledg@eeg.ccf.org> - 2019-02-01 19:20 +0100
                Re: Partition information as text file? Dan Ritter <dsr@randomstring.org> - 2019-02-01 19:30 +0100
                Re: Partition information as text file? David Wright <deblis@lionunicorn.co.uk> - 2019-02-01 23:10 +0100
                Re: Partition information as text file? Peter Ehlert <peter@sdi-baja.com> - 2019-01-29 17:40 +0100
                Re: Partition information as text file? Jude DaShiell <jdashiel@panix.com> - 2019-01-29 19:00 +0100
            Re: Partition information as text file? Richard Owlett <rowlett@cloud85.net> - 2019-01-29 15:40 +0100
              Re: Partition information as text file? Pascal Hambourg <pascal@plouf.fr.eu.org> - 2019-01-29 21:10 +0100
                Re: Partition information as text file? Richard Owlett <rowlett@cloud85.net> - 2019-01-30 16:10 +0100
                Re: Partition information as text file? <tomas@tuxteam.de> - 2019-01-30 17:00 +0100
                Talking about loop devices (was: Re: Partition information as text file?) David <bouncingcats@gmail.com> - 2019-01-31 02:20 +0100
                Re: Talking about loop devices (was: Re: Partition information as  text file?) David <bouncingcats@gmail.com> - 2019-01-31 04:50 +0100
                Re: Talking about loop devices (was: Re: Partition information as  text file?) <tomas@tuxteam.de> - 2019-01-31 10:10 +0100
                Re: Talking about loop devices Pascal Hambourg <pascal@plouf.fr.eu.org> - 2019-01-31 20:00 +0100
                Re: Talking about loop devices David <bouncingcats@gmail.com> - 2019-02-01 06:30 +0100
                Re: Partition information as text file? Joe <joe@jretrading.com> - 2019-01-30 17:10 +0100
                Re: Partition information as text file? Richard Owlett <rowlett@cloud85.net> - 2019-01-31 15:30 +0100
                Re: Partition information as text file? Pascal Hambourg <pascal@plouf.fr.eu.org> - 2019-01-30 19:50 +0100
              Re: Partition information as text file? David <bouncingcats@gmail.com> - 2019-01-30 03:10 +0100
                Re: Partition information as text file? Richard Owlett <rowlett@cloud85.net> - 2019-01-30 16:20 +0100
          Re: Partition information as text file? David Wright <deblis@lionunicorn.co.uk> - 2019-01-29 19:30 +0100

csiph-web