3

Whenever I use VirtualBox to install a Linux distro, I usually install the LiveISO onto the hard drive instead of just using it as a live CD. However, sometimes the ISO doesn't install fully (usually user error), and the prompt comes up to install it to the hard drive again. In addition, liveuser is again the only user, even if I created one before. However, the original partitions are "remembered" somehow, but I can't figure out where they are or how to get to them. The output of df -h is:

Filesystem              Size   Used   Avail   Use%  Mounted on
/dev/mapper/live-rw     3.9G   3.0G    804M    80%  /
devtmpfs                985M      0    985M     0%  /dev
tmpfs                  1002M   136K   1002M     1%  /dev/shm
tmpfs                  1002M   700K   1002M     1%  /run
tmpfs                  1002M      0   1002M     0%  /sys/fs/cgroup
/dev/sr0                953M   953M       0   100%  /run/initramfs/live
tmpfs                  1002M   344K   1002M     1%  /tmp
varcacheyum            1002M      0   1002M     0%  /var/cache/yum
vartmp                 1002M      0   1002M     0%  /var/tmp
/dev/mapper/live-base   3.9G   3.0G    823M    79%  /mnt/install/source

How are these partitions "remembered", and how can I mount them again to get them all pretty & nice, if this is possible? If not, why not?

EDIT

Going by the answers so far, and doing wipefs and cfdisk, all but 2 of the "superblocks", as @mikeserv called them, have some kind of problem when I try to open them. One is the VBox Guest Additions I installed before, now under filesystem /dev/sr0, and the other is the Fedora Live Desktop. Neither filesystem has all the space I gave the partitions. I gave the partitions about 42-43GB, but the VBox Guest Additions has 999MB and the Fedora Live Desktop has 4GB. What's going on?

2 Answers 2

2

Partitioning took place before the error happened so whenever you run the LiveCD on the partitioned virtual hard drive, it is still partitioned. The LiveCD just read what it perceived as a partitioned hard disk.

In order to wipe everything clean, you could either delete the current virtual machine and create a new one, or use the disk tools(cfdisk, fdisk, parted ... etc) on the LiveCD to repartition/reformat your virtual hard disk. You can of course just use the tools to delete the the table and have the LiveCD recreate everything according to its defaults, if you don't want to worry about the layout.

find the mounted partitions using:

mount

and then

fdisk /dev/devicename

12
  • It's not really an error, more of an unexpected result. Commented Mar 12, 2014 at 23:56
  • I meant what you said about "(usually user error)"... Sorry I was quoting. I used it ambiguously here, perhaps. I was quoting what you mentioned about the cause of the interruption of the installation process. Commented Mar 12, 2014 at 23:59
  • Oh, I get you. I was being kind of ambiguous, too, partially because I don't know what the "user error" was. Commented Mar 13, 2014 at 0:02
  • fdisk keeps saying segmentation fault for all the devices it finds. Are they not set up somehow? When I su to root, the username is -bash-4.2. Commented Mar 13, 2014 at 0:15
  • By the way, I don't want to destroy the partitions, I want to use them again because I don't want to have to go through the installation process for the 1,000,000th time. Commented Mar 13, 2014 at 0:18
1

This problem occurs because portions of your partition table remain. There are superblocks for each Linux partition that you create at various offsets in the filesystem depending on the specific implementation. These are markers that the kernel reads when interpreting a physical block device because when you partition a device you rarely zero it - instead you just drop a marker that says,

"Hey, kernel, I'm a filesystem of type ext4 I extend for the next so many blocks. Also, I enjoy long walks on the beach and prefer red wine to white..."

Anyway, luckily handling orphaned superblocks is a simple matter nowadays.

wipefs /dev/sd?

If invoked without any operands the wipefs utility will print to its stdout the first superblock it finds on the device you specify.

wipefs -a /dev/sd?

If invoked with the -a operand wipefs will destroy everysuperblock on the device. It's very fast and will likely solve your problem in seconds.

Another very useful application of wipefs is to use its superblock detection to find backups distributed further on in a filesystem that, say, a failed partitioning attempt has corrupted. It supports a --no-act operand:

wipefs -na /dev/sd? 

The above will output a list of all superblocks in a filesystem. Because most linux filesystems distribute backup copies of their superblocks throughout their partition of a block device, there's a very good chance that you can use wipefs to pull offset data that will enable you to restore the original partition table.

5
  • My problem is I want to use the partitions again, not get rid of them. If I want to get rid of them, I can do that while I am going through the installation process again. Commented Mar 13, 2014 at 0:14
  • Im gonna do a little tmp image testing and hopefully flush out the rescue to a step by step. In the meantime, backup your problem device and have a look at man wipefs. Commented Mar 13, 2014 at 4:02
  • Oh, and installation doesnt always clear a partition table directly, which I thought might have been your issue. Because different filesystems install their superblocks to different offsets, it can sometimes occur that an earlier first superblock remains after partitioning a device and you can repeat over and over again but because the filesystem you're attempting to setup installs its superblock to a later offset than the other the disk will continue to be recognized as the previous filesystem type. That was how I was first introduced to wipefs anyway. Commented Mar 13, 2014 at 4:08
  • Thanks. I mean, I just installed it so I don't really need to back it up, I could just install it again. It's just annoying I have to KEEP installing it, so I want to figure out, for the future, how to NOT have to keep installing it. Commented Mar 13, 2014 at 5:22
  • Im sorry, but this isnt going to happen tonight. Back up the file, then run wipefs -a on it, then reinstall, just in case it really is a matter of reinstallation not correctly zeroing the earlier partition table. Commented Mar 13, 2014 at 6:39

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.